我不知道如何用这个创建$ _SESSION:
$query = $db->prepare('INSERT INTO pro(reference, date_add) VALUES ( :reference, NOW() ) ');
$query->execute(array(
':reference' => $_POST['reference']
));
$_SESSION['reference'] = $_POST['reference'];
$_SESSION['date_add'] = ?
我的日期不是之前发布的,那么如何为我的约会创建会话?
感谢您的帮助!
答案 0 :(得分:1)
这会给你相同的结果:
//MySQL datetime format (same as NOW())
$date = date("Y-m-d H:i:s");
$query = $db->prepare('INSERT INTO pro(reference, date_add) VALUES ( :reference, :date ) ');
$query->execute(array(
':reference' => $_POST['reference'],
':date' => $date
));
$_SESSION['reference'] = $_POST['reference'];
$_SESSION['date_add'] = $date
答案 1 :(得分:-1)
也许可以解决这个问题
$query = $db->prepare('INSERT INTO pro(reference, date_add) VALUES ( :reference, :date_add ) ');
$query->execute(array(
':reference' => $_POST['reference'],
':date_add' => time()
));
$_SESSION['reference'] = $_POST['reference'];
$_SESSION['date_add'] = time();