Php

how to avoid duplicate entries in PHP…while i’m typing a new data to input field then posting my data to page that time how to validate the data alerady in database or not…if the data was already there means the form will ask again enter the name like that… please help to clarify my doubt

Do you want your form to say “this user name is in use” when you go to create your password field, or when your form is submitted?

If your question is about trapping duplicate entries as they go into the database and handling that particular error:

Make that field in your table “unique”, lets call it username.

If you attempt to input another row with a username which has already been used then mysql throws an error number 1062.

You can test for that error and then tell the user to pick another name because that one is “not acceptable” (avoid saying it is already being used).

[fphp]mysql_errno[/fphp]