champbronc2 Posted September 20, 2008 Share Posted September 20, 2008 I have this: $checkpemaile = mysql_query("SELECT * FROM users WHERE referer=''"); $pemail_existe = mysql_num_rows($checkpemaile); What I want is this (roughly, since the problem is that I do not know how to code it correctly!) $checkpemaile = mysql_query("SELECT * FROM users WHERE referer=''"); AND WHERE visits>='4*(currentdate-joindate)'") $pemail_existe = mysql_num_rows($checkpemaile); So what I want it to do is make $checkpemaile not just the number of users whose referer is blank but also must have their visits greater than or equal to the number of days they have been a member. So I need the script to $checkpemaile to meet both requirements. So, if anyone can re-write it correctly it'd be greatly appreciated. I have JUST started php and MySql. Quote Link to comment https://forums.phpfreaks.com/topic/125111-how-to-do-a-mysql-query-with-multiple-where-requirements/ Share on other sites More sharing options...
paulim Posted September 20, 2008 Share Posted September 20, 2008 What you need is something like this : select * from users where referer='' and DATEDIFF(NOW(),joindate) > 0 Quote Link to comment https://forums.phpfreaks.com/topic/125111-how-to-do-a-mysql-query-with-multiple-where-requirements/#findComment-646605 Share on other sites More sharing options...
champbronc2 Posted September 20, 2008 Author Share Posted September 20, 2008 If I am correct, all that means is that their days are more than 0. That's not the issue. Quote Link to comment https://forums.phpfreaks.com/topic/125111-how-to-do-a-mysql-query-with-multiple-where-requirements/#findComment-646670 Share on other sites More sharing options...
fenway Posted September 29, 2008 Share Posted September 29, 2008 Say what? Quote Link to comment https://forums.phpfreaks.com/topic/125111-how-to-do-a-mysql-query-with-multiple-where-requirements/#findComment-653282 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.