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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.