This seems like it should be really easy, but for some reason I just cannot get this to work. I am using the following select statement in my search script:
$query = "select * from my_table where firstname like \"%$urlvar%\" order by lastname";
(the $urlvar is the variable I pull from the url)
That works perfectly. But I want to have a "details" page where you just look at one record. So I tried this to get just one record, with the urlvar variable being equal to a number (the id number of the record I want to pull up):
$query = "select * from my_table where keyfield like \"%$urlvar%\"
order by lastname";
It says no results found. I have tried it with all sorts of numbers (there are over 10, 000 records in this database, each with an auto incremented int keyfield as the last field in the row) and it keeps coming up no matches found. I feel like a moron, but I just cannot figure out why this isn't working. I've looked around php.net and mysql.com but I'm still stuck. Any help would be greatly appreciated. Thanks!
Kristen