RivaCom
11-09-2008, 11:07 AM
PHP and Ajax Form Field Validation
I'm running into a problem with the field validation, maybe someone can point me in the right direction on what i'm doing wrong.http://rafb.net/p/7DFk2h52.html is my registration pagehttp://rafb.net/p/SZVUAN80.html is the username check php page.
When I run it, it returns a sql error.
azizny
11-09-2008, 01:58 PM
Second page is wrong:
PHP Code:
include("config.php"); テつ*テつ*テつ*$q= mysql_escape_string($_GET["q"]);テつ*テつ*テつ*テつ*$sql = mysql_num_rows(mysql_query("SELECT username FROM 'users' WHERE `username` = '$q'")) or die (mysql_error()); // mySQL Queryテつ*テつ*テつ*テつ*if ($sql > 0) {テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*echo("<font-color=\"red\">Username Taken</font>");テつ*テつ*テつ*テつ*} else {テつ*テつ*テつ*テつ*テつ*テつ*テつ*テつ*echo("<font-color=\"Green\">Username Available</font>");テつ*テつ*テつ*テつ*}mysql_close($db_connect);
Take this as an example and see if you can use it:http://awesomephp.com/?Membership-2
Peace,
__________________NEW: What Is Their IP - Anyone's IP a click away.
URL Tracker, Shortener, Blocker, Unblocker, Whois and More.
Codebird
11-10-2008, 02:26 PM
why are you putting '' around table users either remove them or use ``
PHP Code:
$sql = mysql_num_rows(mysql_query("SELECT username FROM `users` WHERE `username` = '$q'"))
__________________Hicham MallahWeb Developer