I have created a form. Now I want to check if the username entered by the user is already on the database or not. If yes, I want it to display an error message.
Thanks
I have created a form. Now I want to check if the username entered by the user is already on the database or not. If yes, I want it to display an error message.
Thanks
its general question
server side check db is like :
$qry = sprintf( 'SELECT `id` FROM `users` WHERE `userName` = \'%s\'', mysql_real_escape_string( $_POST['userName'] ) );
$res = mysql_query( $sql );
$num = mysql_num_rows( $res );
if ( $num )
{
echo 'This user already exists';
}
in the client you can use jquery + ajax call to call this function and show error message.
you can see this article to see what to do in the client :
http://www.ajaxlines.com/ajax/stuff/article/check_username_availability_using_ajax_and_jquery.php