현재 시간 스탬프와 관련된 많은 게시물을 읽었으며 제공된 많은 솔루션을 시도했지만 아무도 내 문제를 해결하지 못했습니다. 데이터베이스에 추가 할 현재 타임 스탬프가 필요합니다. 내 코드가 다른 솔루션이 작동하지 않는 이유 일 수 있다고 생각합니다. 다른 모든 것은 완벽하게 게시됩니다. 타임 스탬프는 저에게 모두 "0"을주었습니다. 시도한 다른 해결책은 "6 행 오류"를주었습니다.현재 시간 스탬프
여기에 내 현재 코드 PHP의 맥락에서 어떤 의미를 CURRENT_TIMESTAMP
을했다 사용하지
<?php
$con = mysql_connect("mysql","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
/* Prevent duplicate submissions */
if (isset($_COOKIE['FormSubmitted']))
{
show_error('You may only submit this form once per session!');
}
mysql_select_db("seller", $con);
$sql="INSERT INTO listing (name, email, website, url, dropdown, price, date, visitors, income, host, description)
VALUES
('$_POST[name]', '$_POST[email]', '$_POST[website]', '$_POST[url]', '$_POST [dropdown]', '$_POST[price]', '$_POST[date]','$_POST[visitors]', '$_POST[income]', '$_POST[host]', '$_POST[description]', 'CURRENT_TIMESTAMP[subdate]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "Thank you for listing with us. <a href="#">Explore Now</a>";
mysql_close($con)
?>
, 이것은 2016 년입니다 **은'mysql_' API를 사용하여 STOP, 매개 변수가있는 질문을 사용하여 시작 **. –
CURRENT_TIMESTAMP https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_current-timestamp에서 읽기 - 또한 문자열로 입력하려고합니다. . –
가능한 복제본 [MySQL - 현재 날짜/시간 삽입?] (http://stackoverflow.com/questions/19246309/mysql-insert-current-date-time) –