Search

segunda-feira, 10 de junho de 2013

PHP with SQLite3

SELECT

$file = 'db/emails.db';

$db = new SQLite3($file);

$result = $db->query('SELECT * FROM EMAILS;');

while ($row = $result->fetchArray()) {
      echo $row[0] . " - " . $row[1] . " - " . $row[2] ;
}

DELETE

$file = 'db/emails.db';
$db = new SQLite3($file);

$result = $db->exec('DELETE FROM EMAILS;');

INSERT

$db = new SQLite3($file);

$file = 'db/emails.db';
$country = $_SERVER["HTTP_CF_IPCOUNTRY"];
$email = trim($_POST['email']);

$query = $db->prepare('INSERT INTO EMAILS(EM_EMAILS, COUNTRY, ACTIVE) VALUES (:email,:country,:active)');

if($query){
$query->bindValue(':email',$email, SQLITE3_TEXT);
$query->bindValue(':country',$country, SQLITE3_TEXT);
$query->bindValue(':active',0, SQLITE3_INTEGER);
$result = $query->execute();
}else{
echo "error";
}

UPDATE

$file = 'db/emails.db';
$db = new SQLite3($file);

$result = $db->exec('UPDATE EMAILS SET EM_EMAIL="test" WHERE COUNTRY="PT";');

If you have any question or problem please leave a comment and i will try to help you ;)


domingo, 9 de junho de 2013

Why should i do something when there's millions already?!

Yep! That's your friends answer when you have an idea and ask them if they want to join you. After that will came the "how much i will win with that?", "i am not going to spend 10 dollars on that", "i need a project that doesn't exist yet, i don't need to invest (even $5) and will make me rich", that's the part i face-palm my self and ask "why god? why....".

So people can't invest $10/$15 dollars in a project, just because that wont make them rich, but they can spend $50 in cigarettes, drinks, and other shits? Ok, that's the kind of society i love(ironic). Lets don't make nothing, because i wont make any money with that!

What about experience an knowledge? Why everyone expect money from what they make?!

As example all of my projects until now were made thinking about letting people know me and my work. My
first project goal was to try to make something that reach 1000 users. The day i got that was fucking amazing! Today i have around 6000 users and i am making some money out of it, without doing nothing... but ofc, when i tryed it for the first time, some people said "why you going to make it?, there's things out there making the same?" AND!?!

Did you know that, there's around 2.405.518.376 internet users? maybe there's room for everyone ideas and projects! just don't give up because someone (that probably never done one decent project in their life) says that are millions already doing the same, go until the end and see what you get from it and you wont regret!