You are here: Re: mysql_affected_rows() alternative « PHP Programming Language « IT news, forums, messages
Re: mysql_affected_rows() alternative

Posted by ZeldorBlat on 04/10/07 14:46

On Apr 10, 10:04 am, Tyno Gendo <you@localhost> wrote:
> Two questions in a row.. I'm on a roll :)
>
> When i perform UPDATEs in my admin system, I'm checking for success by
> using mysql_affected_rows() and this works fine if data is changed and
> updated.
>
> However, if a user submits an admin page without chaning any details,
> the SQL executes fine, but mysql_affected_rows() returns 0 as MySQL is
> clever enough to work out that nothing changed.
>
> How do people deal with this? It hampers my error check as
> mysql_affected_rows() can be 0 for a perfectly valid update.

>From the manual at <http://www.php.net/mysql_query>

"For other type of SQL statements, UPDATE, DELETE, DROP, etc,
mysql_query() returns TRUE on success or FALSE on error."

So check the return value of mysql_query(), not the value of
mysql_affected_rows().

 

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

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