By pwhite on
Hi,
I'm trying to work out how many people are joining my site per week - I'm familiar with module development however I don't know how to work out signups per week from the created field in the users table.
Any ideas or hints in the right direction?
Many thanks
Comments
select count(uid) from users
select count(uid) from users where date(from_unixtime(created)) between date(date_sub(now(), interval 7 day)) and date(now());
That will get you a count of everyone that has joined in the last 7 days
alternatively
select count(uid) from users where date(from_unixtime(created)) between date(date_sub(now(), interval x day)) and date(date_sub(now(), interval x day));
if you replace the x's above you can be more flexible
thanks for that - what if I
thanks for that - what if I wanted to say a week was from sunday to sunday rather than just counting back 7 days?
I think this should get you
I think this should get you the users that signed up last week from Sunday to Sunday.
Here is a way to get all of the users signed up by week in the current year:
Many thanks for that, if its
Many thanks for that, if its any help to someone here is the a way to graph the number of users joining per week with the use of the Open Flash Charts API Module:
Where to post this code?
Thanks, this is useful. But where would I post the code listed above:
" select count(uid) from users where date(from_unixtime(created)) between date(date_sub(now(), interval 7 day)) and date(now()); "
In a template page? Block? View?
I tried adding it in a panel but it just threw up errors. Could well have been my lack of understanding of php though.
Thanks.
Howard Lake
www.fundraising.co.uk
Here is how I did it in Drupal 5.11
Hope this helps someone. I created a block, then used Panels to add this block to my Panel page.
Chris
http://www.lanexa.net