Jump to content

Cant see whats wrong with this query


OriginalSunny

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??
Link to comment
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]
Link to comment
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]
Link to comment
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.