You probably have error reporting turned off in your php.ini file or you 
may be directing errors into your log file, try checking there.

Why are you tacking "or die(mysql_error())" on the end of each of your 
query assignments? You're just assigning a string to a variable so 
there's nothing to fail, or at least no mysql errors.

-Steve


On Wednesday, March 20, 2002, at 10:41  AM, Andrea Caldwell wrote:

> Hi All,   I'm pretty new at this, so go easy on me please ;-)
>
> What is wrong w/ this syntax?  If the search results are 0, it just 
> displays
> a blank screen instead of echoing the error message if numresults ==0 
> or the
> mysql_error message.  If data is found, everything is fine.  Thanks in
> advance for your help!
>
> if($searchterm){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> realname like '%".$searchterm."%'" or die (mysql_error());
> }
> elseif($location){
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> location like '%".$location."%'" or die (mysql_error());
> }
> else{
> $query = "select directory.realname, directory.phone, directory.ext,
> directory.phone2, directory.email, directory.location from directory 
> where
> location like '%".$searchloc."%'" or die (mysql_error());
> }
>
> $result = mysql_query($query) or die (mysql_error());
> $num_results = mysql_num_rows($result)or die (mysql_error());;
>
>  if($num_results==0){
>  echo "Sorry, nothing matched your search request.  Please go back and 
> try
> again.";
>  }
>
>  else {
>  echo "<p><span class=stdtext_bold>Number of Entries Found:
> ".$num_results."</p></span>";
>  }
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to