How PHP is queried by date
The field addtime in MySQL is timestamp
I need to query this now
Xx.php?u=20130328&page=1 &page= This is for paging.
So query 20130328 or 20130329 this day data
Include ". /include/song.inc.php ";
$key = $_get[' u '];
if ($_get["page"]) {
$page =$_get["page"]; #获取要显示的页码
}else{
$page =1; #没有参数传入时, show first page
}
$col =20; #每页显示记录条数
$p = ($page-1) * $COL;
$RUNSQL = mysql_query ("select * from Cmsdj_song where uid = ' $key ' ORDER by ID ' desc limit '. $p.", ". $col.");
while ($row = Mysql_fetch_array ($RUNSQL))
{
Here are the call values
$sid = $row [' id '];
$suid = $row [' uid '];
$supip = $row [' Upip '];
$name = $row [' name '];
$sname =substr ($name, 0,30);
$sfile = $row [' file '];
$surl = $row [' url '];
$SWJDX = $row [' Wjdx '];
$stime =date (' y-m-d h:i:s ', $row [' addtime ']);
$b 64file=base64_encode ($surl);
?>
}
?>
$col =20; #每页显示记录条数
$count =mysql_query ("SELECT ID from Cmsdj_song where uid like '% $key% '"); #取得记录总条数
$num = mysql_num_rows ($count)/$col; #计算页数
$nnx = mysql_num_rows ($count); #计算页数
$num =ceil ($num); #无条件小数进位确定总页数
Mysql_close ();
?>
------Solution--------------------
From_unixtime () Unix timestamp converted to date
Unix_timestamp () date converted to UNIX timestamp
------Solution--------------------
$u = $_get[' u '];
$starttime = Strtotime ($u. ' 000000 ');
$endtime = strtotime ($u. ' 235959 ');
$RUNSQL = mysql_query ("select * from Cmsdj_song where addtime > ' $starttime ' and addtime< ' $endtime ' ORDER by id DESC Limit ". $p.", ". $col.");