You are here: Re: How to corret this mysql select query? « PHP Programming Language « IT news, forums, messages
Re: How to corret this mysql select query?

Posted by Tom Thackrey on 05/29/05 06:35

On 28-May-2005, "Nick" <nick_1394@yahoo.com.cn> wrote:

> I convert some code from access to mysql. And I have a InboxMessage
> table which has From and To field.
> So, the query is like:
> select * from InboxMessage where To=12
> 12 is user id.
> This query works fine in access. But does not work in Mysql.
> I think the problem is the field To, which must be a keyword in mysql.
> So, how to fix this? I don't want to change the field, becuase this
> will need to change a lot of code.

to is indeed a reserved word for mysql. Reserved words can be enclosed in
back-ticks (not apostrophes) to use them as column names, so your query
would be:

select * from InboxMessage where `To`=12


--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация