<?php
$old = "<script>[xss_clean](localStorage.getItem('depart'))</script>";
$sql = "SELECT name FROM sp_linkage_data_2 WHERE id =" .$old;
echo $old;
echo $sql;
$query = urlencode('select * from sp_linkage_data_2 WHERE id ='.$old);
?>
{sql sql='$query'}
{$t.name}
{/sql}
{$debug}提示You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=34' 錯(cuò)誤
這個(gè)該如何調(diào)整?
單獨(dú)echo都是正確的, $old為 34, $sql 也是正確
$old需要是數(shù)字才行,轉(zhuǎn)換一下類型
$query = urlencode('select * from sp_linkage_data_2 WHERE id ='.(int)$old);(以上回復(fù)內(nèi)容已被迅??蚣軇?chuàng)始人修改)
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!