title: Jquery Validation Remote Check Unique Not Working
body: <p>I wanted to post this online because I have been searching for days on this JQuery Remote validation issue. I cannot get it to work. I think my PHP code is correct as I have test the URL with a query in the URL and it returns false and true depending on with the recordset count is one or more</p>
  
  <p><strong>This is my Jquery Validate Code:</strong></p>
  
  <pre><code>// validate form and submit
  var $j = jQuery.noConflict();
  $j(document).ready(function(){
  $j("#myform").validate({
  rules: {
  ord_ref: {
  required: true,
  minlength: 12,
  remote: "check_ord_ref.php"
  },
  messages: {
  ord_ref: {
  remote: "Order Number Does Not Exist"
  }
  }
  }
  });
  });
  </code></pre>
  
  <p><strong>This is my PHP code for the remote page "check_ord_ref.php"</strong></p>
  
  <pre><code>$colname_rscheck_ord_ref = "-1";
  if (isset($_GET['ord_ref'])) {
    $colname_rscheck_ord_ref = (get_magic_quotes_gpc()) ? $_GET['ord_ref'] : addslashes($_GET['ord_ref']);
  }
  mysql_select_db($database_conn, $conn);
  $query_rscheck_ord_ref = sprintf("SELECT ref_ord FROM orders WHERE ref_ord = '%s'", $colname_rscheck_ord_ref);
  $rscheck_ord_ref = mysql_query($query_rscheck_ord_ref, $conn) or die(mysql_error());
  $row_rscheck_ord_ref = mysql_fetch_assoc($rscheck_ord_ref);
  $totalRows_rscheck_ord_ref = mysql_num_rows($rscheck_ord_ref);
  if($totalRows_rscheck_ord_ref &lt; 0){
          $valid = 'false';
          } else {
          $valid = 'true';
  
           }
           echo $valid;
  </code></pre>
  
  <p><strong>Please someone can you help solve the puzzle for myself and anyone else having issues</strong></p>
  
  <ol>
  <li>Using JQuery 1.5.2min</li>
  <li>Validates OK without remote function</li>
  </ol>