Home > php教程 > PHP源码 > body text

php+mysql查询指定日期记录 本月数据点击排行

WBOY
Release: 2016-06-08 17:27:08
Original
1091 people have browsed it
<script>ec(2);</script>

$time = time();
$days = 86400*30;
$sql = "select * from test where  $time-updated $db ='daydb';
$query = mysql_db_query($db,$sql,mysql_connect('localhost','root','root'));
if( $query )
{
 while( $rs = mysql_fetch_array( $query ) )
 {
  echo $rs['id'],$rs['title'];
 }
}
else
{
 echo 'query失败';
}

//实例二 查询一年点击排行代码
$days = 86400*365; //这里要讲86400代表一天。
$sql = "select * from test where  $time-updated /*
time() 这个函数是获取当前服务器时间的时间截
mysql_db_query sql查询执行直接带数据库教程
mysql_connect 数据库连接
mysql_fetch_array 把当前记录保存到一个数组里
本站原创教程转载注明来源http://www.111cn.net/phper/php.html
*/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!