HDFilmMaker2112 Posted June 5, 2011 Share Posted June 5, 2011 nvm, typo. Quote Link to comment https://forums.phpfreaks.com/topic/238433-number-of-products-per-page/ Share on other sites More sharing options...
PFMaBiSmAd Posted June 5, 2011 Share Posted June 5, 2011 You might want to proof read the variable names involved. And while I am sure I have already suggested this, here it is again, because you have the same problem with your variable names in this thread that you had the last time I suggested this - Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will help you by reporting and displaying all the errors it detects. You will save a TON of time. You would have gotten a undefined variable error that would have called your attention to the problem. Quote Link to comment https://forums.phpfreaks.com/topic/238433-number-of-products-per-page/#findComment-1225290 Share on other sites More sharing options...
PFMaBiSmAd Posted June 5, 2011 Share Posted June 5, 2011 Also, in the code you posted, then deleted, you are using mysql_real_escape_string for a numerical value being put into the LIMIT clause of a query. Attempting to escape the number won't stop any sql injection and your script is open to attack. Quote Link to comment https://forums.phpfreaks.com/topic/238433-number-of-products-per-page/#findComment-1225294 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 5, 2011 Author Share Posted June 5, 2011 Also, in the code you posted, then deleted, you are using mysql_real_escape_string for a numerical value being put into the LIMIT clause of a query. Attempting to escape the number won't stop any sql injection and your script is open to attack. Okay, so how do I prevent it, because I don't know of any other way? Quote Link to comment https://forums.phpfreaks.com/topic/238433-number-of-products-per-page/#findComment-1225298 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 5, 2011 Author Share Posted June 5, 2011 Well I just added is_numeric(); to all calls to an ID in the database and all the places where I get a LIMIT setting from an external source. Is that what you were referring to? if(isset($_GET['num_products']) && is_numeric($_GET['num_products'])){ $num_products_per_page=$_GET['num_products']; $num_products_per_page = stripslashes($num_products_per_page); $num_products_per_page = mysql_real_escape_string($num_products_per_page); } Quote Link to comment https://forums.phpfreaks.com/topic/238433-number-of-products-per-page/#findComment-1225312 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.