Jump to content

Archived

This topic is now archived and is closed to further replies.

Moron

Check that database entry exists?

Recommended Posts

I'm working on an employee leave program. The employee puts the employee number in and all sorts of wonderful things happen!  :o

But..... if they put in an invalid (nonexistent) employee number or just some gobbledegook, how can I give them a nice, clean "invalid entry" notice as opposed to SQL errors all over the page?

Share this post


Link to post
Share on other sites
Do a SELECT from database using their empl. number and then check the number of database rows returned from the query result (use mysql_num_rows). If the number of rows returned isn't 1, then their emp. number wasn't found.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.