2 回答
TA贡献1744条经验 获得超4个赞
您的查询看起来不错,但错误的数据类型、无效的 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贡献1797条经验 获得超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 关注
- 112 浏览
添加回答
举报