jQuery Validate remote method usage to check if username already exists

I’ve managed to get this to work by changing the PHP technique I was using, here’s my PHP:

<?php
require_once "./source/includes/data.php";
header('Content-type: application/json');
$request = $_REQUEST['username'];

$query = mysql_query("SELECT * FROM mmh_user_info WHERE username="$username"");
$result = mysql_num_rows($query);
if ($result == 0){
$valid = 'true';}
else{
$valid = 'false';
}
echo $valid;
?>

Thanks everyone here for your help 🙂

Leave a Comment