OriginalSunny Posted March 7, 2006 Share Posted March 7, 2006 Hi, i am getting the following error when trying to perform thie following query[i]Parse error: syntax error, unexpected T_STRING in C:\Project\htdocs\CatalogPayGo.php on line 87[/i] The code i have used is:$query_food = "SELECT s.* FROM stock s INNER JOIN stock_item i ON s.modelNum = i.modelNum WHERE i.prodName = '$_POST[interest]'; $result = mysql_query($query_food,$connect) or die ("query_food: ".mysql_error($connect)); The error seems to be somewhere within query_food? But from what i can see there is nothing wrong with the code for mysql. Any1 see what i am doing wrong?? Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/ Share on other sites More sharing options...
zawadi Posted March 7, 2006 Share Posted March 7, 2006 try this[code]$query_food = "SELECT s.*FROM stock s INNER JOIN stock_item iON s.modelNum = i.modelNumWHERE i.prodName = '".$_POST[interest]."'; [code] Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/#findComment-15021 Share on other sites More sharing options...
OriginalSunny Posted March 7, 2006 Author Share Posted March 7, 2006 I am not sure what u mean by [code] and [/quote] but i have tried it and it still doesnt work. I have tried the following code:$query_food = "SELECT s.*FROM stock s INNER JOIN stock_item iON s.modelNum = i.modelNumWHERE i.prodName = '".$_POST[interest]."';with ' ".$_POST[interest]." '; and it comes up with an error and i have also tried " '$_POST[interest].' "; and it comes up with the error:[i]Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Project\htdocs\CatalogPayGo.php on line 85[/i] Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/#findComment-15053 Share on other sites More sharing options...
wickning1 Posted March 7, 2006 Share Posted March 7, 2006 You don't have an ending double quote.[code]$query_food = "SELECT s.*FROM stock s INNER JOIN stock_item iON s.modelNum = i.modelNumWHERE i.prodName = '$_POST[interest]'";$result = mysql_query($query_food,$connect)or die ("query_food: ".mysql_error($connect));[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/#findComment-15055 Share on other sites More sharing options...
insrtsnhere13 Posted March 7, 2006 Share Posted March 7, 2006 [code]$query_food = "SELECT s.* FROM stock s INNER JOIN stock_item i ON s.modelNum = i.modelNum WHERE i.prodName = '$_POST[interest]'; [/code]im not sure if this is right or not, but you need an ending ". you started it off with "SELECT but never ended it with another "[code]$query_food = "SELECT s.* FROM stock s INNER JOIN stock_item i ON s.modelNum = i.modelNum WHERE i.prodName = '$_POST[interest]'"; [/code]try that and let me knowedit:hahahaha yes!! sorry for the post wickning, i couldnt see yours cuz we were doing it at the same timew00t! thats the first time i helped someone correctly! Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/#findComment-15056 Share on other sites More sharing options...
OriginalSunny Posted March 7, 2006 Author Share Posted March 7, 2006 Well that one worked. LoL what a silly mistake i made. Thanks though. Quote Link to comment https://forums.phpfreaks.com/topic/4321-cant-see-whats-wrong-with-this-query/#findComment-15073 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.