imarockstar Posted November 11, 2008 Share Posted November 11, 2008 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 ?? Link to comment https://forums.phpfreaks.com/topic/132312-solved-update-successful-but-still-getting-an-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 11, 2008 Share Posted November 11, 2008 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? Link to comment https://forums.phpfreaks.com/topic/132312-solved-update-successful-but-still-getting-an-error/#findComment-687885 Share on other sites More sharing options...
imarockstar Posted November 11, 2008 Author Share Posted November 11, 2008 idk why .. lol someone on here told me to put that there for error checking .. i shall take it off lol .. thanks .. b Link to comment https://forums.phpfreaks.com/topic/132312-solved-update-successful-but-still-getting-an-error/#findComment-687962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.