时间:2021-07-01 10:21:17 帮助过:34人阅读
php连接数据库,以及日期处理函数代码如下:
$conn=mysql_connect("10.0.10.0:0000","root","123456") or die("数据库连接失败").mysql_error();//连接数据库 mysql_select_db("database"); $querry1 = "SELECT * FROM `crm_module_27` where field1='" . $ORDER_ID . "'"; $cursor1 = mysql_query($querry1); if ($ROW = mysql_fetch_array($cursor1)) { $startwork=$ROW['field3']; } $now=date("Y-m-d");//日期处理 $nowy=date("y"); $nowy1=date("y",strtotime("-1 year")); $nowy2=date("y",strtotime("+1 year")); $nowm=date("m"); $nowm1=date("m",strtotime("-1 month")); $nowm2=date("m",strtotime("+1 month")); $nowd=date("d"); $startworky=date("y",strtotime($startwork)); $startworkm=date("m",strtotime($startwork)); $startworkd=date("d",strtotime($startwork));
想了解更多PHP的教程,请关注PHP中文网的PHP视频教程!
以上就是php学习之连接数据库+日期处理的详细内容,更多请关注Gxl网其它相关文章!