Hi, I'm creating small form for sign up, one of the text field called "username", I would like to have check available user name from database, if that user name are taken then send message right away after submit it. If user name avalaible then go on to next process.
I wrote small php code for some reason is not working right. I would appreication if you can help me to see what did i missed or correct it please.
My database table name member.
The field in database called username.
The text filed in the form called username.
//
<? php
Open conection to the database
mysql_connect('localhost', 'root', '3250');
mysql_select_db('member');
// Function to check if a username exists inside the database
function check_user_exist($username) {
$username = mysql_escape_string($username);
echo "user name is not available";
}
// Username is available
return array('yes');
}
?>
please help me thanks.
AM