-1
我的代碼:MySQL的語法錯誤
$fileid = $_GET['imgid'];
$fileid = (int)$fileid; //id is int type in photos table
require 'database.php';
//get the image sourc name
$q = "SELECT src form photos WHERE id='$fileid'";
$result = $mysqli->query($q) or die(mysqli_error($mysqli));
if ($result)
{
$row = $result->fetch_object();
$filename = $row->src;
錯誤:你在你的SQL語法錯誤;請檢查與您的MySQL服務器版本相對應的手冊,以便在第1行'照片WHERE ID = '12''處使用正確的語法。
它怎麼會變得脆弱? – 2010-08-02 10:54:06
它似乎只是,直到你看第2行;) – Mchl 2010-08-02 10:55:04
@Col:哎呀,你是對的。沒有注意到它正在被轉換爲'int'。 – 2010-08-02 10:55:09