gwh Posted December 11, 2009 Share Posted December 11, 2009 Hi everyone, Does anyone know what's wrong with the following code: mysql_select_db($database_localhost, $localhost); $query_rsShirts_Desc = "SELECT shirtID, shirtDescLadies, shirtDescMen FROM shirts WHERE shirtID IS '$shirtID'"; $rsShirts_Desc = mysql_query($query_rsShirts_Desc, $localhost) or die(mysql_error()); $row_rsShirts_Desc = mysql_fetch_assoc($rsShirts_Desc); $totalRows_rsShirts_Desc = mysql_num_rows($rsShirts_Desc); $shirtID = 4; //The shirtID of the item you are currently viewing I get the following error: Notice: Undefined variable: shirtID in /Applications/MAMP/htdocs/new_site/catalogue.php on line 47 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 Appreciate any advice. Quote Link to comment https://forums.phpfreaks.com/topic/184786-code-error-on-testing/ Share on other sites More sharing options...
premiso Posted December 11, 2009 Share Posted December 11, 2009 Where is shirtID coming from? I see you have it defined after the query. Is that suppose to be before so the variable is defined and the query will actually pull the contents from shirts where shirtid = 4? Also your "IS" statement should be an = "SELECT shirtID, shirtDescLadies, shirtDescMen FROM shirts WHERE shirtID = '$shirtID'" Quote Link to comment https://forums.phpfreaks.com/topic/184786-code-error-on-testing/#findComment-975513 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.