简体   繁体   中英

Mysql Error: Query was empty

Can anyone tell me why I am getting this error when running my syntax

Error:

Query was empty

Code:

$con= mysql_connect("xxx","cl49-xxx","xxx");
if (!$con) 
{
  die('Could not connect: ' . mysql_error());
}

mysql_select_db("cl49-xxx", $con);

foreach($_POST as $key=>$value) {
  echo "<b>$key:</b> $value<br />";
} 
echo"<br /><br />";
$result = mysql_query("UPDATE pages SET pagename='$pagename' WHERE pageid ='$pageid'") or die(mysql_error());

if (!mysql_query($sql,$con)) { 
  die('Error: ' . mysql_error());
}
mysql_close($con); 
echo' <h2><font color="green">Page Updated Succesfuly</font> </h2>';

Can anyone help?

In this query $sql is used but is is not defined anywhere in you code snippet.

if (!mysql_query($sql,$con)) { 
  die('Error: ' . mysql_error());
}

If you remove above code this message will not come again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM