matvespa Posted January 2, 2010 Share Posted January 2, 2010 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] Quote Link to comment https://forums.phpfreaks.com/topic/186908-live-username-availability-check/ Share on other sites More sharing options...
blueman378 Posted January 2, 2010 Share Posted January 2, 2010 Well, Post your attempt at it and we will help you. Expect us to do it for you and we will not. Quote Link to comment https://forums.phpfreaks.com/topic/186908-live-username-availability-check/#findComment-987077 Share on other sites More sharing options...
matvespa Posted January 2, 2010 Author Share Posted January 2, 2010 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"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/186908-live-username-availability-check/#findComment-987089 Share on other sites More sharing options...
blueman378 Posted January 3, 2010 Share Posted January 3, 2010 Right, well you are on the right track... sortof Now you need to look into ajax, as you will need to run that query every time a user wants to check if the username is avaliable. Quote Link to comment https://forums.phpfreaks.com/topic/186908-live-username-availability-check/#findComment-987443 Share on other sites More sharing options...
matvespa Posted January 3, 2010 Author Share Posted January 3, 2010 Hi I dont dare to touch the javascript. Can someone assist me of which part to edit as im not familiar with javascript. I've attached the script as php cause the code is thousands of lines [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/186908-live-username-availability-check/#findComment-987450 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.