thanks so much for the pointers - my form is still submitting though - please take a look
Main Topics
Browse All Topicsso, i'm trying to check if my email address DOES NOT exist in my db. if it doesn't, i want to not submit the form - i'm using the exact opposite query/logic on another page and it works fine - but when i use the following logic, my form still submits
here's my query - below is the entire chunk of code:
SELECT email_address FROM users WHERE email_address NOT LIKE '%s'"
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You say your form is posting, that is a bit misleading to me, you are checking for the duplication after the form has already posted, this code looks to be at the top of the same page or at the top of another page that is interupting the results and then doing something.
What is the second half of that IF statement, the portion where there is a duplication, what is the code supposed to do if it is duplicated?
Couple of other things I see wrong.
This line is incorrect and will always be true, regardless of the results.
if ((mysql_num_rows($result)=
You only need:
if (mysql_num_rows($result)==
The result will always be filled with something so long as the query executed, it is only looking to see if you have a link, you have a link or you will have a different issue.
Additionally, you are assigning $totalRows_result = mysql_num_rows($result);
For simplicity sake, use if ($totalRows_result==0)
turns out the logic was built into the script elsewhere.
$query_result = sprintf("SELECT email_address, `password`, first_name FROM users WHERE email_address LIKE '%%%s%%'", $colname_result);
$result = mysql_query($query_result)
$row_result = mysql_fetch_assoc($result)
$totalRows_result = mysql_num_rows($result);
$email_address = $row_result['email_address
$first_name = $row_result['first_name'];
$password = $row_result['password'];
$res = mysql_query($query_result)
if($res) {
$msg = "Hello $first_name,\n\nPlease use the following email address and password to log in to SmartBenefit.\n\nEmail address: $email_address\nPassword: $password";
$res = @mail($email_address,'Smar
if(!$res)
echo '';
} else
echo 'Bad sql: '.$query_result."\n".mysql
// Replace with actual page or redirect :P
if(!$res)
echo 'The email address you provided is not in our records. Please <A HREF="javascript:history.g
click here</a> to enter another email address or <a href="register.php">registe
else
echo "<html xmlns=\"http://www.w3.org/
<head>.....
Business Accounts
Answer for Membership
by: pmessanaPosted on 2009-09-02 at 13:46:26ID: 25245538
Couple of things, why are you using NOT LIKE? If the email address isn't there why not use WHERE email_address != '%s'?
Since you have LIKE it would assume you wanted to check for a partial match, but you aren't doing that since there are no wildcards, thus you should switch it.
You say it is not working, what part is not working? If the query is running are you able to run the exact query in MySQL and see the results?
Also, you have if the number of rows =1 then post a message "We do not have an address" except you will never have a row if the address doesn't exist, which is probably where you are seeing the logic go astray. You will want to check for where the number of rows = 0, thus you don't have that address in there.