Jump to content


Photo

Updating table record where field name is "AS"


Best Answer PravinS, 10 May 2013 - 12:47 AM

As "AS" is reserved word in MySQL, so may not be updating the record and also not giving any error as sql syntax is correct.

 

Try using this query

mysql_query("UPDATE registrations SET `AS` = '9' WHERE `ID` = '123' ");
Go to the full post


  • Please log in to reply
2 replies to this topic

#1 pioneerx01

pioneerx01

    Advanced Member

  • Members
  • PipPipPip
  • 145 posts

Posted 10 May 2013 - 12:31 AM

I have a table where one field (column) is called AS. I know that is a command, but I was wondering if there is a way around it. I want to do this:

 

mysql_query("UPDATE registrations SET AS = '9' WHERE ID = '123' ");

 

That AS is throwing it off. I do not get an error, just 9 doues not appear under the AS column in the table.

 

Thanks

 

 



#2 PravinS

PravinS

    Advanced Member

  • Members
  • PipPipPip
  • 421 posts
  • LocationNashik, India

Posted 10 May 2013 - 12:47 AM   Best Answer

As "AS" is reserved word in MySQL, so may not be updating the record and also not giving any error as sql syntax is correct.

 

Try using this query

mysql_query("UPDATE registrations SET `AS` = '9' WHERE `ID` = '123' ");

Thanks & Regards,
PravinS | Blog


#3 pioneerx01

pioneerx01

    Advanced Member

  • Members
  • PipPipPip
  • 145 posts

Posted 10 May 2013 - 01:05 AM

You know that actually worked. I am happy that I do not have to think arround it.

 

I know that 2 letter words like AS IF OR are not the best ones to use.

 

Thanks so much!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com