php时间不正确它的帮助后一小时。 [英] php time not correct its one hour behind help.
本文介绍了php时间不正确它的帮助后一小时。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?php
include( connect.php);
include( Includes / view.php);
session_start();
if(!isset($ _ SESSION [' id']))
{
header(' 位置:../ index.php') ;
}
$ name = $ _SESSION [' 名称跨度>];
$ queue = $ _POST [' queue 跨度>];
// $ TarosID = $ _POST ['TarosID'];
< span class =code-comment> // $ Status = $ _POST ['Status'];
// $ Reason = $ _POST ['Reason'];
$ date = date( Y / m / d);
$ time = date( H: I:的跨度>);
$ query = INSERT INTO sms_traffic_db.table_data(名称,日期,时间,队列)VALUES('。$ name。 ','。$ date。 ','。$ time。 ','。$ queue。 ');
$ result = mysql_query($ query)或 mysql_error();
if($ result)
{
header(' 位置:../ main.php'跨度>);
echo 数据已成功插入跨度>;
}
else
{
header(' 位置:../ add_entry.php');
echo 错误 .mysql_error();
}
echo ' < ; p>'。$ query。' < / p>';
mysql_close();
?>
解决方案
_SESSION [' id']))
{
header(' 位置:../ index.php');
}
name =
_SESSION [' name'];
hey guys i live in south africa and every time i insert the time to my database it gives me 1hour behind current time i think it is because of daylight savings can you help me fix this source below.
<?php
include("connect.php");
include("Includes/view.php");
session_start();
if( !isset($_SESSION['id']))
{
header('Location: ../index.php');
}
$name = $_SESSION['name'];
$queue = $_POST['queue'];
//$TarosID = $_POST['TarosID'];
//$Status = $_POST['Status'];
//$Reason = $_POST['Reason'];
$date = date("Y/m/d");
$time = date("H:i:s");
$query = "INSERT INTO sms_traffic_db.table_data (name, date, time, queue) VALUES ('".$name."', '".$date."','". $time."', '".$queue."')";
$result = mysql_query($query) or mysql_error();
if($result)
{
header('Location: ../main.php');
echo "Data Inserted successfully";
}
else
{
header('Location: ../add_entry.php');
echo "Error" .mysql_error();
}
echo '<p>'.$query.'</p>';
mysql_close();
?>
解决方案
_SESSION['id'])) { header('Location: ../index.php'); }
name =
_SESSION['name'];
这篇关于php时间不正确它的帮助后一小时。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文