You are here: Re: Update query issue... « PHP Programming Language « IT news, forums, messages
Re: Update query issue...

Posted by Rik on 12/17/49 11:55

ZafT wrote:
> Well, I'm back...
>
> I have the script working on other update pages, and the only
> difference is the $show variable. It is currently a smallint (I have
> tried changing to varchar and int with no luck). The id field is an
> int, and the syntax '$id' works on a sister script (but that script
> does not have the '$show' variable. I have tried the
> mysql_real_escape_string() bit proposed by Rik, but to no avail. The
> result is an error like:
>
> 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 'show=1 WHERE id='3'' at line 3
>
> Any more thoughts? This is killing me. It has to be something
> completely rediculous.

Aha, there's th error. Well, 'show' is a mysql function. If your field is
named 'show', use backticks like `show` to use it as a fieldname.

I had this problem quite often with naming fields in mysql when I just
started. In the beginning I chose different names, but now I just put
backticks around every fieldname, every query, all the time. Wether it
necessary or not, it might save some precious hours like these :-).

If you use PHPMyAdmin, it's always a good start when something goes wrong
with the query, to echo the query instead and try it in it's interface.
Thanks to syntax higlighting, errors are spotted easily.


Grtz,
--
Rik Wasmus

 

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

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