欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

php连接数据库,以及日期处理函数

程序员文章站 2022-04-15 16:37:35
php连接数据库,以及日期处理函数 $conn=mysql_connect("10.0.10.0:0000","root","123456") or die("数据库连接失败").mysql_error(); mysql_select_db("database"); $querry1 = "SELE ......

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));