Hi,
try this:
To debug: place:
echo "number of records: ";
echo $rows;
This should show the number of rows.
Also, you could add echo $query; in the script after you have created the query, to see what it actually does. you could then parse the query in your phpadmin to check it works properly.
In the script try adding quotes around the vars: '$first' and '$last', perhaps use like instead of = in the script.
J.