rex9990 Posted March 5, 2008 Share Posted March 5, 2008 Here is code i have and im a bit confused about $charset='UTF-8'; $page1 = htmlentities ($_GET['page'], ENT_NOQUOTES, $charset); if(!isset($page1)){ $page = 1; } else { $page = '$page1'; } $max_results = 10; $from = (($page * $max_results) - $max_results); it gives me the error 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 '-10, 10' at line 1 but if i change "if(!isset($page1))" to "if(!isset($test))" it excutes the page right but with some smaller errors :| Can anyone see whats going wrong? Thanks Steve Quote Link to comment https://forums.phpfreaks.com/topic/94492-whats-wrong-with-this/ Share on other sites More sharing options...
shocker-z Posted March 5, 2008 Share Posted March 5, 2008 where is your excecusion of the mysql statement? you haven't shown the actual query. Regards Liam Quote Link to comment https://forums.phpfreaks.com/topic/94492-whats-wrong-with-this/#findComment-483894 Share on other sites More sharing options...
Psycho Posted March 5, 2008 Share Posted March 5, 2008 Well, I'm not sure what you are trying to accomplish with the htmlentities() command (you should be validating that the value is a whole number). But, your problem is this line: $page = '$page1'; It is setting $page to the string value of "$page1". In fact there is no reason for that line at all: $charset='UTF-8'; $page = htmlentities ($_GET['page'], ENT_NOQUOTES, $charset); if(!isset($page)){ $page = 1; } $max_results = 10; $from = (($page * $max_results) - $max_results); Although I still think you should be doing a different validation other than htmlentities(). Quote Link to comment https://forums.phpfreaks.com/topic/94492-whats-wrong-with-this/#findComment-483903 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.