Dustin Krysak wrote:
Hi there... I have a simple search page (mysql database), and I can get it to display the results no issues, but i was wondering how I could display a message stating there were no results, instead of just having the field blank. I am familiar with IF and ELSE statements, but I am not sure how to test the "no result" option from the results of a SQL query....

thanks!

d


Depends on how you're recieving your results...

function doSearch ( $string ) {
        $sql = "SELECT *.....blah, blah
        more code;
        if ( $result = ....
                return $result;
        } else {
                return false;
        }
}

if ( $search = doSearch ( $terms ) ) {
        // display results

} else {
        // display no results found

}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Reply via email to