任何人都可以解释我如何根据日期显示我的表格记录,就像我网站的任何用户只能看到他们当前日期的事件...
while($data=mysql_fetch_array($rs))
{
$data["create_date"]=date("M d,y" , $data[create_date]);
我正在使用它,但它也显示以前日期的结果
这是我的代码,我正在从不同的表中获取结果
$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);
}
最佳答案
您也可以为此使用 MySQL
。
示例
select * from table_name where create_date >= NOW();
或
SELECT * FROM table_name WHERE DATE(create_date) = CURDATE();
或
SELECT * FROM table_name WHERE DATE(create_date) = DATE(NOW())
DATE()
returns the date without time andNOW()
returns the currentdate & time
(note we’ve used the DATE() function in this query to remove the time)
关于php - 根据当前日期获取记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15715640/