gpt4 book ai didi

php - 在php中使用查询时出现语法错误

转载 作者:行者123 更新时间:2023-11-29 18:26:33 25 4
gpt4 key购买 nike

有人帮我解决这个查询,错误是语法错误,

unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)

 $sl = "select * from sanpham where id='$_GET['id']'";

最佳答案

小心数组和键。

 $sl = "select * from sanpham where id='{$_GET['id']}'";

或者

 $sl = "select * from sanpham where id='" . $_GET['id'] . "'";

关于php - 在php中使用查询时出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46143266/

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