Jump to content


Photo

Cant see whats wrong with this query


  • Please log in to reply
5 replies to this topic

#1 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 07 March 2006 - 12:32 PM

Hi, i am getting the following error when trying to perform thie following query

Parse error: syntax error, unexpected T_STRING in C:\Project\htdocs\CatalogPayGo.php on line 87


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

#2 zawadi

zawadi
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationChippenham UK

Posted 07 March 2006 - 12:36 PM

try this

[code=auto:0]$query_food = "SELECT s.*
FROM stock s INNER JOIN stock_item i
ON s.modelNum = i.modelNum
WHERE i.prodName = '".$_POST[interest]."'; [code=auto:0]
That's the beauty of asymmetric warfare. You don't need a lot of money, or an army of people. You can do it from the comfort of your living room, with a beer in your hand.

#3 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 07 March 2006 - 01:51 PM

I am not sure what u mean by [code=auto:0] 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:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in C:\Project\htdocs\CatalogPayGo.php on line 85


#4 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 07 March 2006 - 01:57 PM

You don't have an ending double quote.

$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));


#5 insrtsnhere13

insrtsnhere13
  • Members
  • PipPipPip
  • Advanced Member
  • 64 posts

Posted 07 March 2006 - 01:59 PM

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

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 "


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

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!

#6 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 07 March 2006 - 02:42 PM

Well that one worked. LoL what a silly mistake i made. Thanks though.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users