I'm playing with the Jquery Validation Plugin: http://jqueryvalidation.org/ in an attempt to validate the email_address field on the login page prior to hitting the submit button (so customers having login troubles can tell if it is their email address that is incorrect).

What the page should do: as soon as someone enters a value in the email_address field, the jquery loads a php file that contains a sql call to see if the email address exists in the database and returns a message based on the results.

I'm stuck on the sql portion. At this point I have gone as far as removing all variable from the process until I can get the basic sql to return a result.

Code:
<?php
 
/* check if email is already registered */
 
if (!empty($_POST['email']))
{
    global $db;
    $sql = "SELECT customers_id FROM zen_customers WHERE customers_email_address = 'atestemail######################' LIMIT 1";
    $result = $db->Execute($sql);
    if($result->RecordCount()>0)
    
    {
        echo "true";  //good to register
    }
    else
    {
        echo "false"; //already registered
    }
}
else
{
    echo "false"; //invalid post var
}
 
?>