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
https://forums.phpfreaks.com/topic/186908-live-username-availability-check/
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";

}

 

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.