gpt4 book ai didi

php - 使用 MySQL 插入 $_SESSION 变量时 PHP 中出现意外的 T_CONSTANT_ENCAPSED_STRING

转载 作者:太空宇宙 更新时间:2023-11-03 12:13:39 25 4
gpt4 key购买 nike

<分区>

我收到这个错误:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING

对于这个查询:

$insert = mysql_query("INSERT INTO bookings (product_code, email, delivery, del_date, col_date, booking_date, event_type, quantity, cost) VALUES (".$_SESSION["booking"].", ".$_SESSION["logged_in"].", ".$_SESSION["delivery"].", ".$_SESSION["del_date"]", ".$_SESSION["col_date"].", ".$current_date.", ".$_SESSION["event_type"].", ".$_SESSION["quantity"].", ".$_SESSION["price"].")");

而且我无法弄清楚是什么原因造成的,我已经尝试了所有我能想到的方法,但我对 MySQL 查询不是很有经验。

编辑:我现在已经解决了这个问题,现在更正的另一个错误是我错过了 session ​​变量周围的 ',例如:

VALUES ("'".$_SESSION["variable"]."', '".$_SESSION["variable2"]."'")

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com