检索数据Mysql / Php的日期 [英] Retrieve data Mysql / Php where date

查看:95
本文介绍了检索数据Mysql / Php的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用php从我的数据库中检索数据,以获得今天的热门歌曲。

hey, I'm wondering how to retrieve data from my database using php to get the top songs today.

现在我只是得到了最棒的歌曲使用

Right now I'm just getting the top songs using

$result = mysql_query("SELECT tag, COUNT(*) AS the_tags FROM tags GROUP BY tag ORDER BY the_tags DESC LIMIT 16");

我也将标签表中的日期存储在格式

I am also storing the date in the tags table aswell, in the format

07-25-2010

07-25-2010

所以月 - 日 - 年

so Month - Day - Year

如何将结果限制为今天日期的标签?

How can i have it limit the results to tags with the date of today?

感谢:)

推荐答案

另一种方法:

"SELECT tag, COUNT(*) AS the_tags FROM tags WHERE `date` = '" . date('m-d-Y') . "' GROUP BY tag ORDER BY the_tags DESC LIMIT 16"

但是我更喜欢使用MySQL的日期(所以我会说看artefacto的帖子)

But I prefer to use MySQL's date (so I would say see artefacto's post)

这篇关于检索数据Mysql / Php的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆