Reply to Re: How do I handle mysql not found conditions?

Your name:

Reply:


Posted by Rik Wasmus on 11/09/07 18:07

On Fri, 09 Nov 2007 18:52:30 +0100, Big Moxy <bigmoxy@gmail.com> wrote:

> On Nov 9, 9:38 am, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
>> On Fri, 09 Nov 2007 18:25:36 +0100, Big Moxy <bigm...@gmail.com> wrot=
e:
>> > $rows =3D mysql_num_rows($result) or die(mysql_error());
>>
>> How do you think this well act if the result of mysql_num_rows() is 0=
?
>
> I want mysql_num_rows() =3D 0 to be treated as a not found condition.
> Isn't that already handled?

0 converted to boolean is false, so your code die()'s. There is no actua=
l =

mysql error, so the die(mysql_error()) will die without any message. =

Remove the 'or die' clause, you already handle a 0 result in your if =

statement further on, and a faulty result with your 'or die' following t=
he =

mysql_query().
-- =

Rik Wasmus

[Back to original 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

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