Kryllster Posted December 13, 2007 Share Posted December 13, 2007 I am using a basic setup of Apache 2 (the latest) and php (also the latest) that I have installed and configured. my ohoh info came back ok and I ran 1 test svript and retrieved data from an sqlite db. My pronlem is I want to learn the Sqlite db and Im having a hard time trying to connect and add info from a form into the db. Here is the error I get from my php script Warning: sqlite_query() expects at least 2 parameters, 1 given in C:\mywebs\htdocs I have pasted that into google without getting any usable results. I have checked the Sqlite home page but they are mostly about Sqlitr3 and that is pdo which I dont understand yet. I have checked the php home site and nothing I can use from there. So I tried to use some of the code from Mysql here is the code I used: <?php $uname = $_POST['uname']; $address = $_POST['addy']; // set path of database file $db = $_SERVER['DOCUMENT_ROOT']."/../email.db"; // open database file $handle = sqlite_open($db) or die("Could not open database"); sqlite_query("INSERT INTO list (name, address) Values ($uname, $address)"); sqlite_close($handle); ?> I have also done a search from this forum with just the search term Sqlite with only 1 result. Is there anyone who knows how I can use sqlite or is it better to stick with Mysql. Personally I like the idea of less is more but. Thanks, Quote Link to comment Share on other sites More sharing options...
rab Posted December 13, 2007 Share Posted December 13, 2007 sqlite_query($handle,"YOUR QUERY"); Its needs the resource link Quote Link to comment Share on other sites More sharing options...
Kryllster Posted December 13, 2007 Author Share Posted December 13, 2007 Thank's for the quick reply the topic is solved here is the resulting code: <?php $uname = $_POST['uname']; $address = $_POST['addy']; // set path of database file $db = $_SERVER['DOCUMENT_ROOT']."/../email.db"; // open database file $handle = sqlite_open($db) or die("Could not open database"); sqlite_query($handle, "INSERT INTO list (name, address) Values ('$uname', '$address')"); sqlite_close($handle); ?> Thatl do Thatl do! Thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.