what i would like is to select a table lets say "drinks" get the column of the item
lets say "screwdriver" via it's id.
in my index.php you can select the tables, and double click on the item and it directs
to my show.php
this is my show.php.
Code: Select all
$db = "c:/server/sqlite/selection.db";
$handle = sqlite_open($db) or die("Could not open database");
if (isset($_GET["tableName"])) {
$table = sqlite_escape_string($_GET["tableName"]);
$query = "SELECT * FROM $table";
if (isset($_GET['id'])) {
$id = sqlite_escape_string($_GET['id']);
$query = "SELECT * FROM $query WHERE item_id='$id' ORDER BY item_id";
$result = sqlite_query($handle, $query) or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle)));
$class = "";
if ($count % 2 == 0) {
$class = "row index" .$count. " even";
} else {
$class = "row index" .$count. " odd";
}
echo "<TR id=\"$row[0]\" class=\"$class\">\n";
echo "\t<TD class=\"first\">$count</TD>\n";
for ( $i = 0; $i <= sqlite_num_fields($result)-1; $i += 1) {
echo "\t<TD class=\"cell\">$row[$i]</TD>\n";
}
echo "</TR>\n";
$count++;
}
}
sqlite_close($handle);Error: [2 at line 19] sqlite_query() [function.sqlite-query]: near "SELECT": syntax error
Error in query: SQL logic error or missing database
how can i define my select statement so it works?