In message <[EMAIL PROTECTED]>, Wade Smart
<[EMAIL PROTECTED]> writes
>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>';
> }
> }
>}
Presumably, you mean that there are no records for that product?
> if($result = mysql_query($query, $dbc)){
if (mysql_num_rows ($result)){
...(then you got some rows)
}else{
(you didn't get any!)
}
Hope that's right. I use an object for connection, so don't need to
worry about this <G>
--
Pete Clark
Sunny Andalucia
http://hotcosta.com/Andalucia.Spain