I have written/modified a script that searches a table for a name that user wants to look for. it works. the problem I am having is if there are multiple names that are the same it will only return the first one it finds. what do I need to do to have the script keep searching? here is what I have so far:
<?php
require('mydb.inc');
mysql_connect("localhost",$user,$password);
$database="employeeprofiles";
@mysql_select_db("$database") or die( "Unable to select database");
/*Search database for name*/
$query="SELECT name,position,extention,phone from employees where name like '%$searchtext%'";
$result=mysql_query($query);
mysql_close();
/*Display Results*/
$num=mysql_numrows($result);
if ($num == 0) {
echo "I'm sorry. There were no matches for that name.";
}
Bookmarks