我在这里很困惑,如何选择table_date_time = $ _GET [' date_time'];
的表格<?php
require 'core/init.php';
$schedule_id = $_GET['id'];
$schedule_date_time = $_GET['date_time'];
$session_id = $_GET['session'];
$user_id = $_GET['user'];
$user_email = $_GET['email'];
$user_name = $_GET['username'];
$registry_id = $_GET['registry'];
$check1 = DB::getInstance()->query("SELECT * FROM chat_schedule WHERE schedule_date_time = $schedule_date_time");
if ($check1->count()) {
$insert = DB::getInstance()->insert('chat_booked', array(
'schedule_id' => $schedule_id,
'schedule_date_time' => $schedule_date_time,
'session_id' => $session_id,
'user_id' => $user_id,
'user_email' => $user_email,
'user_name' => $user_name,
'registry_id' => $registry_id
));
if ($insert = true) {
echo "Insert was Successful";
}
} else {
echo "No Match Found, INSERT FAILED!";
}
我是否需要解析日期或其他内容。我无法弄明白:(
答案 0 :(得分:1)
将$schedule_date_time
更改为 '$schedule_date_time'
,如:
"SELECT * FROM chat_schedule WHERE schedule_date_time = '$schedule_date_time' "