我試圖知道每次在我的數據庫中保存一個新條目的時間和日期。所以我設置列如下:時間戳不工作
的問題是,我只是歌廳0000-00-00 00:00:00的日期/時間:
的代碼,即時通訊使用更新數據庫是:
<?php
$lat = $_GET['lat'];
$lon = $_GET['lon'];
$fecha = $_GET['fecha'];
// Make a MySQL Connection
$db_database = "xxx";
$db_hostname = "xxx";
$db_username = "xxx";
$db_password = "xxx";
$enlace = mysql_connect($db_hostname, $db_username, $db_password);
if (!$enlace) {
die('No pudo conectarse: ' . mysql_error());
}
echo 'Conectado satisfactoriamente. <br>';
// mysql_close($enlace);
mysql_select_db('xxxxx') or die(mysql_error());
$q = "INSERT INTO `posicion` (`Hora`, `Latitud`, `Longitud`) VALUES
('$fecha', '$lat','$lon')";
//Run Query
$result = mysql_query($q) or die(mysql_error());
echo "Tamos redi";
?>
它可能是什麼?
非常感謝。
怎麼樣。你插入數據? – 2014-10-17 15:51:31
從服務器調用一個.php文件: http://www.example.com/update.php?lat=x&lon=y – 2014-10-17 15:52:56
您能告訴我們您的PHP腳本是否插入數據 – 2014-10-17 15:53:31