check if value exsists in database

hi there,
ive got a page that shows up listings and it gets the id from the database and displays the information. But the problem is that i only want it to be able to get the info from the right database ids, but if you put in a random number like 8123217512 at the top it still displays the page but with no info cuz it doesnt exsist. So what im wondering is how could i check the data first before it displays and go back to homepage if there is no such id??

Here is the first few lines of the page


Thanks Steve

If you try to select on an ID that doesn’t exist in the database, the result set won’t have any records in it. mysql_num_rows() ftw :)

Sponsor our Newsletter | Privacy Policy | Terms of Service