simcityfreak4 Posted June 22, 2007 Share Posted June 22, 2007 Ok, here is my code: $idu = mysql_escape_string($_GET['id']); $rid = mysql_escape_string($_GET['rid']); $viewa = mysql_escape_string($_POST['VIEW_AVS']); $timed = mysql_escape_string($_POST['VIEW_TIME']); $timefp = mysql_escape_string($_POST['timefp']); $RULEZ = "UPDATE `Members` SET `viewa` = '$viewa', `timed` = '$timed', `timef` = '$timefp' WHERE `board` = '$mboard' AND `user` = '$muser' AND `id` = '$idu'"; echo $RULEZ; mysql_query($RLUEZ); echo mysql_error(); When I echo the query is says: UPDATE `Members` SET `viewa` = '1', `timed` = '1', `timef` = 'ka' WHERE `board` = 'Brian' AND `user` = 'Brian' AND `id` = '3' I run that in phpMyAdmin and it works fine. But when it echos mysql_error, is says: Query was empty Do you say anything that could cause this? Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/ Share on other sites More sharing options...
chigley Posted June 22, 2007 Share Posted June 22, 2007 mysql_query($RLUEZ); // to: mysql_query($RULEZ); Typo Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280404 Share on other sites More sharing options...
simcityfreak4 Posted June 22, 2007 Author Share Posted June 22, 2007 Thanks, that kinda fixed it. But now when I echo the query and run it in phpMyAdmin, it works, but if let the script run it, somehow it updates everything to be blank. Any ideas? Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280409 Share on other sites More sharing options...
chigley Posted June 22, 2007 Share Posted June 22, 2007 Change mysql_escape_string() to mysql_real_escape_string(). You should enable error reporting too. Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280412 Share on other sites More sharing options...
simcityfreak4 Posted June 22, 2007 Author Share Posted June 22, 2007 I tried the error thing and did get any errors and change the escape thing didn't fix it either. :-\ Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280416 Share on other sites More sharing options...
chigley Posted June 22, 2007 Share Posted June 22, 2007 Put error_reporting(1); at the top of your file? Also use echo "<pre>".print_r($_GET, true)."</pre><br /><br /><pre>".print_r($_POST, true)."</pre>"; to check the $_GET and $_POST variables are being received properly. Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280417 Share on other sites More sharing options...
simcityfreak4 Posted June 22, 2007 Author Share Posted June 22, 2007 Still didn't get any errors. This is what that gave: Array ( [act] => save [id] => 3 [rid] => 0188707001182542881 ) Array ( [VIEW_AVS] => 1 [VIEW_TIME] => 1 [timefp] => asdf [submit] => Change Account Options ) Link to comment https://forums.phpfreaks.com/topic/56776-solved-query-was-empty-error/#findComment-280418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.