0

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?

Sumurai8
  • 20,333
  • 11
  • 66
  • 100

1 Answers1

1

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.

Maz I
  • 3,664
  • 2
  • 23
  • 38