Jump to content

Live Username Availability Check


matvespa

Recommended Posts

Hi, I want to validate user email address when they registering. I found this code online, but not able to make it validate against my database.

 

Here is the link: http://roshanbh.com.np/2008/04/check-username-available-ajax-php-jquery.html

 

Im validating against my database from:

table: user

field name: UserEmail

 

I didnt change the textbox field in index.php and i keep it as it is (username)

Im afraid it will conflict with the code. I just changed the user_availability.php to connect to my database.

 

 

I've also attached the code i've modified with database(user_availability.php). It does not validate against my database. Can anyone help?

 

 

Thanks!

 

 

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

Here is code i've

I didnt touch the index and jquery, only changed the user_availability code.

 

here is the user_availability code that i've edit:

 

<?php

//connect to database, blah blah

 

$con = mysql_connect("localhost","winecom1_bizbyte","jerijeri");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

 

 

mysql_select_db("winecom1_wine7000", $con);

 

 

$query = "SELECT * FROM user where UserEmail = '{$_POST['username']}'";

 

$result = mysql_query($query);

if(mysql_num_rows($result)>0){

//username already exists

echo "yes";

}else{

echo "no";

}

 

 

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.