按时间搜索数据的问题 查mysql中文参考手册7.4.11 日期和时间函数 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 function showdate($overnum,$varname,$postvar){ echo "<select name='".$varname."'>"; for($w=1;$w<=$overnum;$w++){ if(strlen($w)==1){ $z="0".$w; }else{ $z=$w; } echo "<option value='".$z."'"; $z=intval($z); if(intval($postvar)==$z){ echo " selected"; } echo ">".$w."</option>"; } echo "</select>"; } //列出今后三天的记录 if(empty($_POST['showorder'])){ $starttime=date("Y-m-d H:i:s"); list($expyear,$expmonth,$expday)=explode("-",date("Y-m-d")); list($exphour,$expminute,$expsec)=explode(":",date("H:i:s")); $tmptime=mktime($exphour,$expminute,$expsec,$expmonth,$expday,$expyear); $tmptime=strtotime("+3days",$tmptime); $anontime=date("Y-m-d H:i:s",$tmptime); list($expyear1,$expmonth1,$expday1)=explode("-",$anontime); } if(isset($_POST['showorder'])){ $starttime=date("Y")."-".$_POST['frommonth']."-".$_POST['fromday']." ".$_POST['fromhour'].":00:00"; $anontime=date("Y")."-".$_POST['tomonth']."-".$_POST['today']." ".$_POST['tohour'].":00:00"; if($starttime>$anontime){ $anontime=(date("Y")+1)."-".$_POST['tomonth']."-".$_POST['today']." ".$_POST['tohour'].":00:00"; } } $sql="select * from tablename where 时间字段>'".$starttime."' and 时间字段<'".$anontime."' order by 时间字段"; $result=mysql_query($sql); echo "<table border=0 cellpadding=2 cellspacing=1 width=100%>"; echo "<form method=post action='".$_SERVER['PHP_SELF']."'>"; echo "<tr bgcolor=ceafce align=middle><td colspan=5>"; echo "从"; if(isset($_POST['showorder'])){ showdate(12,"frommonth",$_POST['frommonth']); }else{ showdate(12,"frommonth",$expmonth); } echo "月"; if(isset($_POST['showorder'])){ showdate(31,"fromday",$_POST['fromday']); }else{ showdate(31,"fromday",$expday); } echo "日"; if(isset($_POST['showorder'])){ showdate(23,"fromhour",$_POST['fromhour']); }else{ showdate(23,"fromhour",$exphour); } echo "时 至"; if(isset($_POST['showorder'])){ showdate(12,"tomonth",$_POST['tomonth']); }else{ showdate(12,"tomonth",$expmonth1); } echo "月"; if(isset($_POST['showorder'])){ showdate(31,"today",$_POST['today']); }else{ showdate(31,"today",$expday1); } echo "日"; if(isset($_POST['showorder'])){ showdate(23,"tohour",$_POST['tohour']); }else{ showdate(23,"tohour",$exphour); } echo "时"; echo " <input type=submit name='showorder' value='显示'>"; echo "</td></tr>"; echo "</form>"; echo "</table>"; <?phpecho strtotime ("now"), "\n";echo strtotime ("10 September 2000"), "\n";echo strtotime ("+1 day"), "\n";echo strtotime ("+1 week"), "\n";echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";echo strtotime ("next Thursday"), "\n";echo strtotime ("last Monday"), "\n";?> WAMPSERVER下如何配置mysql 关于搜索技术问题 mkdir("d:/你好",0700) 执行后,其中的汉字“你好”变成了乱码?为什么 freebsd php5.3 pdo_odbc 查询 sql server varchar类型 text类型不显示 数组的操作问题! 急救!!简单问题! 请问一个关于getdate()的使用问题 IIS新建的网站打不开。。。高分求高手指导 php获取数组中相加和最接近或等于给定值的算法(类似01背包) mssql_query执行查询语句报错 估计这不是个大问题,请看看! 请问mysqldump出现这样的错误信息是怎么回事
echo "<select name='".$varname."'>";
for($w=1;$w<=$overnum;$w++){
if(strlen($w)==1){
$z="0".$w;
}else{
$z=$w;
}
echo "<option value='".$z."'";
$z=intval($z);
if(intval($postvar)==$z){
echo " selected";
}
echo ">".$w."</option>";
}
echo "</select>";
} //列出今后三天的记录
if(empty($_POST['showorder'])){
$starttime=date("Y-m-d H:i:s");
list($expyear,$expmonth,$expday)=explode("-",date("Y-m-d"));
list($exphour,$expminute,$expsec)=explode(":",date("H:i:s"));
$tmptime=mktime($exphour,$expminute,$expsec,$expmonth,$expday,$expyear);
$tmptime=strtotime("+3days",$tmptime);
$anontime=date("Y-m-d H:i:s",$tmptime);
list($expyear1,$expmonth1,$expday1)=explode("-",$anontime);
} if(isset($_POST['showorder'])){
$starttime=date("Y")."-".$_POST['frommonth']."-".$_POST['fromday']." ".$_POST['fromhour'].":00:00";
$anontime=date("Y")."-".$_POST['tomonth']."-".$_POST['today']." ".$_POST['tohour'].":00:00";
if($starttime>$anontime){
$anontime=(date("Y")+1)."-".$_POST['tomonth']."-".$_POST['today']." ".$_POST['tohour'].":00:00";
}
} $sql="select * from tablename where 时间字段>'".$starttime."' and 时间字段<'".$anontime."' order by 时间字段";
$result=mysql_query($sql); echo "<table border=0 cellpadding=2 cellspacing=1 width=100%>";
echo "<form method=post action='".$_SERVER['PHP_SELF']."'>";
echo "<tr bgcolor=ceafce align=middle><td colspan=5>";
echo "从";
if(isset($_POST['showorder'])){
showdate(12,"frommonth",$_POST['frommonth']);
}else{
showdate(12,"frommonth",$expmonth);
}
echo "月";
if(isset($_POST['showorder'])){
showdate(31,"fromday",$_POST['fromday']);
}else{
showdate(31,"fromday",$expday);
}
echo "日";
if(isset($_POST['showorder'])){
showdate(23,"fromhour",$_POST['fromhour']);
}else{
showdate(23,"fromhour",$exphour);
}
echo "时 至";
if(isset($_POST['showorder'])){
showdate(12,"tomonth",$_POST['tomonth']);
}else{
showdate(12,"tomonth",$expmonth1);
}
echo "月";
if(isset($_POST['showorder'])){
showdate(31,"today",$_POST['today']);
}else{
showdate(31,"today",$expday1);
}
echo "日";
if(isset($_POST['showorder'])){
showdate(23,"tohour",$_POST['tohour']);
}else{
showdate(23,"tohour",$exphour);
}
echo "时";
echo " <input type=submit name='showorder' value='显示'>";
echo "</td></tr>";
echo "</form>";
echo "</table>";
echo strtotime ("now"), "\n";
echo strtotime ("10 September 2000"), "\n";
echo strtotime ("+1 day"), "\n";
echo strtotime ("+1 week"), "\n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n";
echo strtotime ("next Thursday"), "\n";
echo strtotime ("last Monday"), "\n";
?>