--- Wade Smart <[EMAIL PROTECTED]> wrote:
> 20080728 1321 GMT-6
>
> I want to post a message that when there are NO product available. Its turned
>
> out to be more difficult than I thought.
>
> I tried is_array, empty, !empty, thinking - well, if its empty then I know
> nothing is there. But its not working.
>
> if(mysql_select_db('wt')){
> $query = "SELECT name FROM deer_product WHERE
> deer_type='".$_GET['deer_type']."'";
>
> if($result = mysql_query($query, $dbc)){
> while ($row = mysql_fetch_array($result)){
> print '<center>';
> if(!empty($row[0])){
> print '<p>
> <ahref="deer_product.php?deer_type='.$_GET['deer_type'].
> '&name='.$row[0].'"><b>'.$row[0].'</b></a></p>';
> } else {
> print 'There is no '.$_GET['deer_type'].' for sale at this time.';
> }
> print '</center>';
> }
> }
> }
If no rows are returned from your query, your while() loop may never get run.
You can select a count() in your query for each item and this way you'll get a
number (even 0) for them.
James