Forum Moderators: coopster

Message Too Old, No Replies

Unknown column '****' in 'where clause'

         

bodycount

7:57 am on Sep 24, 2008 (gmt 0)

10+ Year Member



I am having a problem with the following.

PHP Code.
------------------------
$query =("UPDATE rmatable SET RMACLOSED = '$RMACLOSED' , PASSEDTO = '$PASSEDTO', STATUS = '$STATUS', DATERETURNED = '$DATERETURNED', TRACKNO = '$TRACKNO' WHERE RMA = '$row_ID' AND SERIALNO IN(".implode(",",$_POST['id']).")");

Echo of Query
------------------------
UPDATE rmatable SET RMACLOSED = 'YES' , PASSEDTO = 'Chris McKee', STATUS = 'SHIPPED', DATERETURNED = '2008-09-19', TRACKNO = '' WHERE RMA = 'RMAD122' AND SERIALNO IN(6025400010,6025400111)

The above bits work until I have a SERIALNO like this 25408070003A in the " AND SERIALNO IN(6025400010,25408070003A) " bit of the code, This is the error message I get.

" Unknown column '25408070003A' in 'where clause' "

It looks like any SERIALNO with a letter at the end wont work, Is there anyway this can be fixed?

Thanks

Rob.

Sekka

8:28 am on Sep 24, 2008 (gmt 0)

10+ Year Member



Tried putting quote marks around it so it is taken as a string and not a field name?

bodycount

8:45 am on Sep 24, 2008 (gmt 0)

10+ Year Member



Thanks for the reply but how would I do it in this
SERIALNO IN(".implode(",",$_POST['id']).")");

This bit adds the comma

(","
but when i put ("','" it does not work. any ideas ?

phranque

9:22 am on Sep 24, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



try this:
... AND SERIALNO IN('" . implode("','",$_POST['id']) . "')");

bodycount

9:47 am on Sep 24, 2008 (gmt 0)

10+ Year Member



When I add " ',' " I get the following error

AND SERIALNO IN(15','25408070003A). 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 '','25408070003A)' at line 1

phranque

12:00 pm on Sep 24, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



let's see your code - i think you missed a couple of my single quotes...

... AND SERIALNO IN('" . implode("','",$_POST['id']) . "')");

bodycount

12:11 pm on Sep 24, 2008 (gmt 0)

10+ Year Member



User error DOH!

That works.

Thanks for all your help.