phpretard Posted May 27, 2009 Share Posted May 27, 2009 I am trying to check against 3 different table for an email when a reg form is posted. I have never done it. This is what I have: $dupcheck=mysql_query("SELECT Email.profile_admin, Email.profile_appraiser, Email.profile_user FROM profile_admin, profile_appraiser, profile_user WHERE Email.profile_admin, Email.profile_appraiser, Email.profile_user='".$_POST['Email']."' ") or die(mysql_query()); $num_Email = mysql_num_rows($dupcheck); if ($num_Email > 0){ duplicate email } ...and It Doesn't Work. Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/ Share on other sites More sharing options...
gevans Posted May 27, 2009 Share Posted May 27, 2009 What's your error? what should happen and what does happen? And I just looked at your sql, its compltetly wrong. ill have a quick look and tidy it up Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843528 Share on other sites More sharing options...
gevans Posted May 27, 2009 Share Posted May 27, 2009 Actually it doesn't make sense. Why are you trying to return the email address taht you're putting in? Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843533 Share on other sites More sharing options...
phpretard Posted May 27, 2009 Author Share Posted May 27, 2009 This is hacked but it works. function DuplicateEmailCheck() { connect(); $admin=mysql_query("select Email from profile_admin where Email='".$_POST['Email']."' "); $user=mysql_query("select Email from profile_user where Email='".$_POST['Email']."' "); $appraiser=mysql_query("select Email from profile_appraiser where Email='".$_POST['Email']."' "); $num_admin = mysql_num_rows($admin); $num_user = mysql_num_rows($user); $num_appraiser = mysql_num_rows($appraiser); $checkAll=$num_admin + $num_user + $num_appraiser; if ($checkAll > 0){ return true; } mysql_free_result($admin); mysql_free_result($user); mysql_free_result($appraiser); } and it may explain what I am trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843551 Share on other sites More sharing options...
MadTechie Posted May 27, 2009 Share Posted May 27, 2009 $dupcheck=mysql_query("SELECT Email.profile_admin, Email.profile_appraiser, Email.profile_user FROM profile_admin, profile_appraiser, profile_user WHERE Email.profile_admin='".$_POST['Email']." OR Email.profile_appraiser='".$_POST['Email']." OR Email.profile_user='".$_POST['Email']."' ") or die(mysql_query()); Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843555 Share on other sites More sharing options...
phpretard Posted May 27, 2009 Author Share Posted May 27, 2009 It died: Wrong parameter count for mysql_query() in any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843568 Share on other sites More sharing options...
MadTechie Posted May 27, 2009 Share Posted May 27, 2009 oops $dupcheck=mysql_query("SELECT Email.profile_admin, Email.profile_appraiser, Email.profile_user FROM profile_admin, profile_appraiser, profile_user WHERE Email.profile_admin='".$_POST['Email']."' OR Email.profile_appraiser='".$_POST['Email']."' OR Email.profile_user='".$_POST['Email']."' ") or die(mysql_query()); Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843571 Share on other sites More sharing options...
phpretard Posted May 27, 2009 Author Share Posted May 27, 2009 I really thank you for your help...but it died again same thing. Sorry Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843575 Share on other sites More sharing options...
MadTechie Posted May 27, 2009 Share Posted May 27, 2009 THe query is fine, Wrong parameter count for mysql_query() is a php error, you have either not selected a database or have no connection/link to the database Quote Link to comment https://forums.phpfreaks.com/topic/159937-solved-query-3-tables/#findComment-843584 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.