php - Mysql now () + INTERVAL 1 DAY 在实时服务器上返回 0000-00-00 00:00:00
问题描述
我正在做一个项目。我刚刚将它上传到我的实时服务器。当用户发布工作时,我使用 mysql now() + INTERVAL 和工作交付时间来设置过期时间,这样我就可以选择过期的工作而不选择所有工作。这在我的本地开发环境中工作正常,但在现场它会在 db 中插入 0000-00-00 00:00:00。
有什么建议么?
$job['delivery_time'] = 8; // can have a number from 1 to 29
$sql = "INSERT INTO jobs(job_id, posted_by, title, category_id, description, required_freelancers, budget, delivery_time, job_expiration, date_posted, updated_at) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, now() + INTERVAL " . $job['delivery_time'] . " DAY, ?)";
$stmt = mysqli_stmt_init($db);
mysqli_stmt_prepare($stmt, $sql);
$current_time = date('U');
mysqli_stmt_bind_param($stmt, 'sssisisiii', $job['id'], $user_id, $job['title'], $job['category'], $job['description'], $job['required_freelancers'], $job['budget'], $job['delivery_time'], $current_time, $current_time);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);
解决方案
推荐阅读
- objective-c - 如何在 Xcode 中编译使用 protobuf 的项目?
- google-chrome-devtools - 为什么条码扫描器会在 chrome 中打开 Chrome 开发者控制台?
- javascript - 如何在 Javascript 上使用 RegEx 从字符串中获取范围值
- javascript - 在 typeahead 输入框中添加图标
- outlook - Outlook API - 使用数据获取 Webhook 通知
- python - Pandas:在单个操作中从单个系列创建两个列表
- installation - 由于 WiX 安装,添加显示 HTML 页面
- python - 在 Web 应用程序中加载大尺寸模型文件
- jboss - 哪个版本的 jboss EAP 支持 IBM MQ 9.0.0.5?
- javascript - event.preventDefault() 在一种情况下有效,但在其他情况下无效