Sort by today, this week, this month

if($by==’today’) { $cond.=” and DATE(activity_crtd)='”.date(“Y-m-d”).”‘”; }
if($by==’week’) { $cond.=” and YEARWEEK(activity_crtd) = YEARWEEK(‘”.date(“Y-m-d”).”‘) “; }
if($by==’month’) { $cond.=” and YEAR(activity_crtd) = ‘”.date(“Y”).”‘ and MONTH(activity_crtd) = ‘”.date(“m”).”‘ “; }

$qry = “select * from `table_name` where status=’Active’ “.$cond
<select onchange=”window.location=’my_profile.php?by=’+this.value” name=””>
<option value=”all”>All </option>
<option value=”today”>Today</option>
<option value=”week”>This Week</option>
<option value=”month”>This Month </option>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s