web_master Posted October 27, 2008 Share Posted October 27, 2008 hi, can somebody help me what is this? what is this problem? You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-3, 3' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/ Share on other sites More sharing options...
rhodesa Posted October 27, 2008 Share Posted October 27, 2008 can you post the SQL query? Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675795 Share on other sites More sharing options...
web_master Posted October 27, 2008 Author Share Posted October 27, 2008 <?php // OnOff if($_POST['posters_onoff_submit']) { if($_POST['posters_onoff'] == "0") { $query_update = mysql_query("UPDATE `posters` SET `posters_onoff` = '1' WHERE `posters_id` = '".$_POST['posters_id']."' "); } if($_POST['posters_onoff'] == "1") { $query_update = mysql_query("UPDATE `posters` SET `posters_onoff` = '0' WHERE `posters_id` = '".$_POST['posters_id']."' "); } } // end of OnOff if($_POST['posters_delete_submit']) { print "<fieldset class=\"photodeletefield\"> <legend class=\"photodelete\">BIZTOS TÖRLÖD?</legend> <form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\"> <div class=\"divcenter\"><input type=\"submit\" name=\"posters_delete_confirm_submit\" value=\"TÖRÖL\" class=\"button-red\" /></div> <div><input type=\"hidden\" name=\"posters_id\" value=\"".$_POST['posters_id']."\" /></div> <div><input type=\"hidden\" name=\"page\" value=\"".$_REQUEST['page']."\" /></div> </form> </fieldset>"; } if($_POST['posters_delete_confirm_submit']) { $query_update = mysql_query("UPDATE `posters` SET `posters_delete` = '1' WHERE `posters_id` = '".$_POST['posters_id']."' "); } // Delete // Pagination if(!isset($_REQUEST['page'])) { $page = 1; } else { $page = $_REQUEST['page']; } $max_results = 3; $from = (($page * $max_results) - $max_results); // select fromba // LIMIT $from, $max_results // Reload from dBase $query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." "); // Check query if(!$query_return){ print mysql_error(); exit; } // Request query while($request = mysql_fetch_array($query_return)) { // Onoff if($request['posters_onoff'] == "0") { $posters_onoff_submit_value = "KIKAPCSOLVA"; $posters_onoff_submit_class = "button-red"; } elseif ($request['posters_onoff'] == "1") { $posters_onoff_submit_value = "BEKAPCSOLVA"; $posters_onoff_submit_class = "button-green"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675809 Share on other sites More sharing options...
revraz Posted October 27, 2008 Share Posted October 27, 2008 Looks like it's in here $query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." "); Check your $from variable to see if it contains -3 Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675813 Share on other sites More sharing options...
The Little Guy Posted October 27, 2008 Share Posted October 27, 2008 change your $_REQUEST to either $_GET or $_POST It could be the problem. $_GET = value from url $_POST = value from form (usually) Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675817 Share on other sites More sharing options...
rhodesa Posted October 27, 2008 Share Posted October 27, 2008 Looks like it's in here $query_return = mysql_query("SELECT * FROM `posters` WHERE `posters_delete` = '0' ORDER BY `posters_id` DESC LIMIT ".$from.", ".$max_results." "); Check your $from variable to see if it contains -3 yup, that looks like the issue. the first value for LIMIT has to be 0 or greater Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675843 Share on other sites More sharing options...
web_master Posted October 27, 2008 Author Share Posted October 27, 2008 thank you, I made a basic mistake, maybe Im tired! THANXS Quote Link to comment https://forums.phpfreaks.com/topic/130303-solved-what-is-this-mysql-syntax-3-3/#findComment-675846 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.