Member Avatar for lewashby

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; } ?> 
Member Avatar for cereal

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.

Member Avatar for lewashby

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.

Member Avatar for lewashby

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

Be a part of the DaniWeb community

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