You are here: Re: PHP help with if else « All PHP « IT news, forums, messages
Re: PHP help with if else

Posted by Jerry Stuckle on 08/28/07 00:15

Steve wrote:
>> You didn't show us your SELECT statement, but if it doesn't return any
>> rows, your mysql_fetch_array() call will return false - and not execute
>> anything in the loop.
>>
>>
>
> You're right, I didnt think of the array returning false.
>
> So how would i check for a value in the array, if the array returns false? Or
> how would I check for ANY results?
>

if mysql_fetch_array() returns false, there are no (more) rows to retrieve.

You can check mysql_num_rows() to see how many rows are returned. Or
you can try to fetch the first row - if it doesn't work, put out a
default. If it does work, go into a loop (ensure you fetch the next row
at the end of the loop - not the beginning!).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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