QUOTE
I have tried working with the code above but got all confused. It makes sense but I just cant make sense of it.
What does this mean? What does it mean to "work with" code? Do you understand it, or did you just copy a chunk verbatim from somewhere? Have you read an introduction to SQL / MySQL / databases? Have you found the PHP manual yet? (It's here:
http://jp2.php.net/manual/en/index.php * subject to prejudicial redirection.)
To get you started:
QUOTE
$query = "select * from userid where fldID like \"%$trimmed%\" order by fldID";
This is an SQL query. Do you understand what the bits are? The * means retrieve all fields - which is what you want.
QUOTE
$numresults=mysql_query($query);
Have you read the explanation of the mysql_query() function in the php manual? It returns a "resource", which mean a sort of tag that just identifies the set of search results. Calling this "numresults" is odd, because it is not the number of results.
QUOTE
$numrows=mysql_num_rows($numresults);
.. but mysql_num_rows() does return the number of results. so that's ok, but...
QUOTE
if ($numrows == 3)
Huh? If there are 3 results, print a message saying there aren't any??? Why?