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 ;)
Sem comentários:
Enviar um comentário