我正在从我正在开发的患者系统中获取当前的葡萄糖读数。我使用 java 脚本获取当前日期/时间并通过表单隐藏字段过去。在下面的脚本中,我将日期部分存储在 3 个单独的变量中,然后将它们连接为 1,以便我可以在 mysql 的插入查询中使用它。我得到的错误是
解析错误:语法错误,意外的','希望有人能找到错误,因为我不明白通过在变量之间放置','我做错了什么。这是代码:
<?
SESSION_START();
include("DatabaseConnection.php");
//gather form data into variables
//gather parts of the date from hidden input fields
$Day = $_POST['Day'];
$Month = $_POST['Month'];
$Year = $_POST['Year'];
$Date = $Year, "-", $Month, "-", $Day; //line with error
//get hours and minutes from hidden fields
$Minutes = $_POST['Minutes'];
$Hours = $_POST['Hours'];
//concatinate date into 1 variable
$Time = $Hours, ":", $Minutes;
$GlucoseLevel = $_POST['GlucoseLevel'];
$SBP = $_POST['SBP'];
$DBP = $_POST['DBP'];
$Comments = $_POST['Comments'];
//store current user's id
$User_id = $_SESSION['User_id'];
//query for inserting reading
$ReadingInsert = "insert into reading
(Reading_id,
User_id,
Date,
Time,
GlucoseLevel,
SBP,
DBP,
Comments)
values(null,
'$User_id',
'$Date',
'$Time',
'$GlucoseLevel',
'$SBP',
'$DBP',
'$Comments')";
//run insert query
mysql_query($ReadingInsert) or die("Cannot insert reading");
`enter code here`mysql_close();
?>