RE: Question: For no results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm



On 03 December 2004 14:39, Stuart Felenstein wrote:

> I want to send back a message when no matches are
> found on my search page.  Basically "No matches
> found".  I assumed that mysql_fetch_assoc would be the
> determining factor on whether any rows will come back.
>  As you can see below I do a if ($row_rsCS == false).
> Apparently though (while the message is sharp and
> centered ;)), it is not to right place, since it sends
> the message and exits whether records / matches exist or not.   Any
> suggestions ? 
> 
> Thank you
> Stuart
> 
> $query_limit_rsCS = sprintf("%s LIMIT %d, %d",
> $query_rsCS, $startRow_rsCS, $maxRows_rsCS);
> //print_r($query_limit_rsCS);
> $rsCS = mysql_query($query_limit_rsCS, $Pmmodel) or
> die(mysql_error()); //print_r($rsCS);
> $row_rsCS = mysql_fetch_assoc($rsCS);
> 
> if ($row_rsCS == false)
> ?>

The closing ?> of a PHP segment also implies an end-of-statement semicolon
-- so the above is equivalent to:

   if ($row_rsCS == false) ;
   ?>

Which, of course, means that the scope of the if doesn't extend to anything
beyond this point.

You need to mark the block controlled by the if, using either {-} or
:-endif, according to your taste.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux