2 回答

TA貢獻(xiàn)1744條經(jīng)驗 獲得超4個贊
您的查詢看起來不錯,但錯誤的數(shù)據(jù)類型、無效的 id 或變量或違反其他約束可能是問題所在。
使用 PDO 語句很好,因為它更安全。
您可以將代碼修改為,
$sql = "UPDATE `company` SET?
? `name` = '" . $companyName . "',
? `parent_ID` = '" . $companyParent . "',
? `address` = '" . $address . "',
? `phone` = '" . $phone . "',
? `fax` = '" . $fax . "',
? `email` = '" . $email . "',
? `remarks` = '" . $remarks . "',
? `type` = '" . $type . "',
? `status` = '" . $status . "'
? WHERE `id` = '" . $id . "' " ;
$stmt = $pncon->prepare($sql); //prepare statement
$stmt->execute(); //execute the query

TA貢獻(xiàn)1797條經(jīng)驗 獲得超4個贊
$pncon->query("UPDATE company SET
name = '$companyName',
parent_ID = '$companyParent',
address = '$address',
phone = '$phone',
fax = '$fax',
email = '$email',
remarks = '$remarks',
type = '$system',
status = '$status'
WHERE id = '$id'");
- 2 回答
- 0 關(guān)注
- 148 瀏覽
添加回答
舉報