Jump to content


Photo

Don't see whats wrong with PHP + MySql Query here..


  • This topic is locked This topic is locked
2 replies to this topic

#1 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 01 August 2006 - 01:13 AM

I run this code..
mysql_query("UPDATE bf SET price='$price'  WHERE location='$fetch->location' &&owner='$username' && name='$store2'");
and it runs perfectly.. then i copy paste it, change price to order.. it doesn't work..
mysql_query("UPDATE bf SET order='$order' WHERE Name='$store2' && owner='$username' && location='$fetch->location'")
The mysql table is set the same,and the $order does work.. if i put 10, then echo $order; it works perfectly..

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 01 August 2006 - 01:17 AM

ORDER is a reserved word - http://htmlite.com/mysql002a.php

You can't name a table column with a reserved word.  The best solution is to change order to x_order or some non-reserved word.  You can also (sloppy solution) wrap reserved words with backticks ... `order`
Legend has it that reading the manual never killed anyone.
My site

#3 Dobakat

Dobakat
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 01 August 2006 - 01:18 AM

silly mistakes.. thanks..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users