You are here: Re: mysql_error on an update « PHP Programming Language « IT news, forums, messages
Re: mysql_error on an update

Posted by Rich on 01/31/06 19:24

In article <1138722255.036505.213460@f14g2000cwb.googlegroups.com>, Jeff says...
>
>What's the best practice for handling the following situation, when I
>do an update like this:
>
>$sql = "UPDATE haha SET papa="loco" WHERE id=$var";
>$res = mysql_query($sql,$db);
>
>If I don't get a match in my where clause, i.e., 12!=44 the UPDATE does
>not occur but mysql_errno == 0 and mysql_error = "" so I can't capture
>the failure.
>
>Any thoughts?
>
>Jeff
>

If there isn't a match, then there would just be no updates to make, so that
won't show up with mysql_error.

It wouldn't be a failure because the query did try to make a match, but there
was just nothing to return back. Think there's a "mysql_affected_rows" function
that may be closer to what you're looking for.

Rich
--
Newsguy -- http://newsguy.com

 

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

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