You are here: Re: MySql Error 'Unknown Column' from PHP variable « PHP Programming Language « IT news, forums, messages
Re: MySql Error 'Unknown Column' from PHP variable

Posted by Larry in Honolulu on 12/09/06 19:30

In article <fksjn21rkcqrt7ndg1cot1lg4jk76f5r7t@4ax.com>, Michael Fesser <netizen@gmx.de> wrote:
>..oO(Larry in Honolulu)
>
>>I'm getting an error message that makes no sense to me. I have a table with a
>>field named 'testkey' for a list of "keys" in the form of ABC10102. I have a
>>php variable holding a specific key number.
>>
>>The relevant code is -
>> $_testkey = 'LAL10102';
>> $sql = "SELECT * FROM `pro_keys` WHERE `keynum`=`$_testkey`";
>> $result=mysql_query($sql,$db_conn);
>
>Strings in an SQL query have to be quoted (and drop the backticks):
>
>$sql = "SELECT * FROM pro_keys WHERE keynum = '$_testkey'";
>
>Micha

Thanks Michael,

I've been away from MySql for a while and forgot that. Oddly I have another
query on the same page (different fields and different variable) that uses the
same syntax, though with no backtics and no quotes of any kind that works just
fine.

Larry L

 

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

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