Jump to content

Archived

This topic is now archived and is closed to further replies.

OriginalSunny

Cant see whats wrong with this query

Recommended Posts

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??

Share this post


Link to post
Share on other sites
try this

[code]$query_food = "SELECT s.*
FROM stock s INNER JOIN stock_item i
ON s.modelNum = i.modelNum
WHERE i.prodName = '".$_POST[interest]."'; [code]

Share this post


Link to post
Share on other sites
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 i
ON s.modelNum = i.modelNum
WHERE 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]

Share this post


Link to post
Share on other sites
You don't have an ending double quote.

[code]$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));[/code]

Share this post


Link to post
Share on other sites
[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 know

edit:
hahahaha yes!! sorry for the post wickning, i couldnt see yours cuz we were doing it at the same time

w00t! thats the first time i helped someone correctly!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.