Trying to create a form to edit my mysql table from a webpage.
I keep receiving the error "Query was empty"..
I have re-read it all for hours and can't find the error myself.
Here is my code if anyone can spot it...
Code: Select all
<?php
if (isset($_REQUEST['Submit'])) {
$result = "UPDATE $db_table(idname,title,description,instructions,certification,author,authorwebsite,width,height,day,month,year,category,hits)
VALUES('$_POST[idname]', '$_POST[title]', '$_POST[description]', '$_POST[instructions]', '$_POST[certification]', '$_POST[author]', '$_POST[authorwebsite]', '$_POST[width]', '$_POST[height]', '$_POST[day]', '$_POST[month]', '$_POST[year]', '$_POST[category]', '$_POST[hits]')";
if($result = mysql_query($sql ,$db)) {
echo '<center><h1>Thank you</h1>Your information has been updated';
} else {
echo "ERROR: ".mysql_error();
}}
else {
?>
<?php
$id=mysql_real_escape_string($_GET['id']);
// Performing SQL query
$query = ("SELECT * FROM games WHERE id = '$id'") or die(mysql_error());
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Printing results in HTML
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { ?>