Jump to content

show results depending on date?


xwishmasterx

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.