Check your books for 'authentication'. I'm sure you'll find something. Else a search on the internet for
php mysql authentication will give you plenty examples as well.
I use a 'user' table in every database (so not the user table provided in the mysql database itself).
When you add a user, you store the password in encrypted form. In the code below, replace
mycrypt by one of the crypt functions supplied by MySQL (see chapter 12.9.2)
Code:
insert into user set login='genderbender',pwd=mycrypt('genderbender password')
The following code can be used for authentication
Code:
select * from user where login='supplied login' and pwd=mycrypt('supplied password')
If the query returns a row, it's a valid user.