各位前輩好:
我在PHP中寫sql指令後於網站裡執行:
$sql = "SELECT * FROM item WHERE shown = 1 , id LIKE '102%'";
echo $sql;
mysqli_query($conn, $sql);
echo mysqli_errno($conn) . ": " . mysqli_error($conn) . "\n";
執行結果如下:
SELECT * FROM item WHERE shown = 1 , id LIKE '102%'
1064: 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 ' id LIKE '102%'' at line 1
在網路上找的範例,對LIKE的條件也都是用單引號包起來的
但不曉得為什麼在測試的時候就出現錯誤,感覺語法沒有錯...
請教各位前輩,是否我還有遺漏了什麼東西
謝謝