Dinesh
Dinesh

Reputation: 447

fetching record according current date

can any one explain how i would display my table record according date, like any user of my website can see their activity of current date only...

while($data=mysql_fetch_array($rs))
    {
    $data["create_date"]=date("M d,y" , $data[create_date]);

i am using this but it displaying previous date result also

here is my code, i am fetching result from different tables

$SQL="select * from  $tab  where 1 $con ORDER BY id desc $_REQUEST[sort_mode] $con_limit";
     while($data=mysql_fetch_array($rs))
        {
        $data["create_date"]=date("M d,y" , $data[create_date]);

    gri("users","WHERE id='$data[op_id]' ","",$op_name);
    gri("patient", " where id ='$data[patient_id]' order by id desc","",$patient);
        $data[first_name]=$patient[first_name];
        $data[last_name]=$patient[last_name];
        $data[age]=$patient[age];$data[sex]=$patient[sex];
        $data[mob]=$patient[mob];
        $data[op_name]=$op_name[name];
        $t->set_var($data);
        $t->set_var(array("chk_status_$data[id]_$data[status]"=>"selected",));
        $t->parse("ABlockList","AccessBlockList",true);
        }

Upvotes: 2

Views: 4263

Answers (1)

Dipesh Parmar
Dipesh Parmar

Reputation: 27354

You can also use MySQL for this.

Example

select * from table_name where create_date >= NOW();

OR

SELECT * FROM table_name  WHERE DATE(create_date) = CURDATE();

OR

SELECT * FROM table_name WHERE DATE(create_date) = DATE(NOW())

DATE() returns the date without time and NOW() returns the current date & time (note we’ve used the DATE() function in this query to remove the time)

Upvotes: 2

Related Questions