Jump to content

[SOLVED] update successful but still getting an error ... ????


imarockstar

Recommended Posts

I just posted above and I figured out my own problem .. but now I have ran across this ..

 

my script works and it is updating my DB. However I am getting an error ...

 

 

 

FORM

<form method="post" action="scripts/adsense_go.php">
<input type="hidden" name=id value=<? echo $rows['id']; ?>>

<textarea class=edittext name=code>
<? echo $rows['code']; ?>
</textarea>

<br>

<input type="submit" name="submit" value="submit">


</form>

 

 

 

INSERT SCRIPT

//convert all the posts to variables:

   $id = $_POST['id'];
   $code = $_POST['code'];






mysql_query("UPDATE adsense SET code = '$code' WHERE id = '$id' ") or die (mysql_error());
$result = mysql_query($sql) or die("ERROR: " . mysql_error() . "<Br>SQL: " . $sql);

 

 

 

ERROR

ERROR: Query was empty
SQL:

 

why am I getting this error when I is working ??

 

Because your code contains two mysql_query() statements and the second one is using a variable $sql that does not exist and would therefor give a Query was empty error. Why do you have two mysql_query() statements in your code?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.