Page 1 of 1

when a search yeilds zero results...

Posted: Thu Aug 28, 2008 10:17 am
by Wilbo
Hi there, I'm making a simple search function for my news article system
and I was wondering if anyone can tell me how I can detect when the search yields no results.

So when there's no matches, it says 'Sorry no matches' or whatever.

I'm doing the usual thing of a LIKE clause in my SELECT statement, and I've tried several things, such as:
if (empty($result)) {
or
if (empty($row)) {
or
if ($result == 0) {
etc etc

but none of them give the desired result :)

I'm sure this is a basic question, so why not help out a noob?

Thanks in advance,

Wilbo

Re: when a search yeilds zero results...

Posted: Thu Aug 28, 2008 10:20 am
by jayshields

Code: Select all

mysql_num_rows()
Please read the manual, search the manual and/or Google search before asking such questions! :)

Re: when a search yeilds zero results...

Posted: Thu Aug 28, 2008 10:31 am
by Chalks
jayshields wrote:Please read the manual, search the manual and/or Google search before asking such questions! :)
The manual is located at php.net