Add to a sqlite database

<?php
//open db
if (!($db = sqlite_open(‘sample.db’)))
{
    die(sqlite_error_string(sqlite_last_error($db)));
}
//data to be inserted
$cat = ‘search’;
$title = ‘yahoo search’;
$sql = “insert into sample (cat, title) values (‘$cat’,’$title’)”;
//insert new data
if (!(sqlite_query($db, $sql)))
{
    die(‘SQL ERROR: ‘ . sqlite_error_string(sqlite_last_error($db)));
}
else
{
 echo “data entered”;
}

//close
sqlite_close($db);
?>

LEAVE A REPLY

Please enter your comment!
Please enter your name here

*