xwishmasterx Posted August 24, 2008 Share Posted August 24, 2008 Hello  I am not sure that this is even possible, but then again I am not an expert in the php-arena :-)  I have this piece of code that shows the top 100 sponsors:  $rs=mysql_query("select * from topref order by ref desc limit 0,100"); while($arr=mysql_fetch_array($rs)) { $rs1=mysql_query("select * from users where Username='$arr[0]'"); $arr1=mysql_fetch_array($rs1); echo "<br> User:$arr[0] have $arr[1] Referrals";  Is it possible to show the results for "last week" and "current week"  The members have a signup date located in the "users" table..  Let me know if you need more info :-)  Regards, Casper Link to comment https://forums.phpfreaks.com/topic/121131-show-results-depending-on-date/ Share on other sites More sharing options...
fenway Posted August 25, 2008 Share Posted August 25, 2008 First, why not a JOIN? And it's very scary to use array references like that... in fact, you mean $arr1 on your last line. I'm just guessing column names here....  select t.ref, u.username from topref inner join users where u.username = t.username order by t.ref desc limit 100  As for your actual question, you can use WHERE signup_date > CURDATE() - INTERVAL 7 DAY. Link to comment https://forums.phpfreaks.com/topic/121131-show-results-depending-on-date/#findComment-625225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.