PHP / MYSQL Question


Hi all,

Not sure if this is an easy fix or not, but I just finished creating a few pages for our site from existing code. (Funds are low, so we are on a do-it-yourself basis.)

Things seem to work fine, except when i pass on a variable in the URL and use the $GET function to pull the rest of the information from MYSQL… ($sql="SELECT * FROM demo8 where Product ID = ‘$_GET[id]’ ":wink:

I don’t get any errors, but I can’t seem to import the product information on the web page…

Any help would be Greatly appreciated! (I can post code later, didn’t want to create a huge post)


Perhaps you should do something like:

$input_id = $_GET['id']; if ((strlen($input_id) > 0) && !preg_match('/[^0-9]/', $input_id)) { // $iinput_id is not empty and only contains digits 0-9 $sql = "SELECT * FROM `demo8` where `Product ID` = '$input_id'";) } else { // $input_id is empty or contains a non-digit character echo "Input error"; }