Forum Moderators: coopster
I am getting the following error message:
"Query2 failed: 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 '' at line 1"
The error occurs when the following code is run:
"...
$cat = $_GET["PROD_CAT"];
$item = $_GET["PROD_ID"];
if(!$cat) { $cat=PROD_CAT; $item=PROD_ID;}
$qry = "Select * from PRODUCT Where PROD_CAT=" . $cat . ";";
$rs = mysql_query($qry) or die ('Query1 failed: ' . mysql_error() . '<br>');
//only one item in ResultSet use?_fetch_array() to move to it
$row = mysql_fetch_array($rs);
$catname = $row["PROD_CAT_NAME"];
$qry = "Select * from PRODUCT Where PROD_ID=" . $item . ";";
$rs = mysql_query($qry) or die ('Query2 failed: ' . mysql_error() . '<br>');
// only one item in ResultSet use?_fetch_array() to move to it
$row = mysql_fetch_array($rs);
$iname = $row["PROD_NAME"];
..."
PROD_ID was created as an int in the Db. I think that makes the quotes properly placed at this point.