Jump to content

[SOLVED] Very confused


Kryllster

Recommended Posts

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,

 

 

Link to comment
https://forums.phpfreaks.com/topic/81574-solved-very-confused/
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/81574-solved-very-confused/#findComment-414249
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.