Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How 2 know if keyword search isn't existing?

Status
Not open for further replies.

Phutie

Programmer
Jul 31, 2000
29
PH
Hi,

for example I have this script:

if ($KeyWords != "")
{
$my_array = explode(" ", $KeyWords);
$count = count($my_array);

if ($count == 1)
{
$sql = ("SELECT BanID from KeyWords WHERE Kwords LIKE '%$my_array[0]%'");
$result = mysql_query($sql);

How will I know if the keyword I entered is not present on the KeyWords table? I need to display "Not Found" else if it is found on the table it should say "Found"

Please help, thanks!

Phutie
}
 
Hi Phutie,

Just use the mysql_num_rows() on the result.
ie. $found_num = mysql_num_rows($result);

mysql_num_rows() returns the number of rows in a
result set.


cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top