I created a small table with one entrey with three columns but I can't get it to show up in my php code. I'm not really doing anything with the form variables right now I'm mainly focused on getting the code below that to query my SQLite DB.

<?php
// get variable from html form
$fName = $_POST['fname'];
$lName = $_POST['lname'];
$address = $_POST['email'];

$db = sqlite_open('./ET')
{
        $result = sqlite_query($db, 'select * from customers');
        echo $result;
}
?>

Recommended Answers

Line 8, change it to:

if($db = sqlite_open('./ET'))

I suppose ET is the name of the database file.

Jump to Post

Here's a code snippet for SQLite2 and SQLite3.

Line 8 has no semi-colon, or if as cereal mentions. …

Jump to Post

All 7 Replies

Line 8, change it to:

if($db = sqlite_open('./ET'))

I suppose ET is the name of the database file.

Here's a code snippet for SQLite2 and SQLite3.

Line 8 has no semi-colon, or if as cereal mentions. You need to fetch from the result.

I've revised the code but it's still showing a blank page. And yes, et is the database.

<?php
echo "<html>";

// get variable from html form
$fName = $_POST['fname'];
$lName = $_POST['lname'];
$address = $_POST['email'];

if($db = sqlite_open('./et', 0666, "$error_message"))
{
$result = sqlite_query($db, 'select * from customers');
echo "$result";
}
echo "hello world!";
echo "</html>";
?>

Body tag is missing in the output, and you're still not fetching from the result.

I added the body tags, it hepled nothing. I didn't think that was it.

Did you look at the code snippets I gave?

Closed. Continued here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.