第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我正在嘗試使用 PHP 通過查詢更新數(shù)據(jù),但數(shù)據(jù)庫中的數(shù)據(jù)沒有變化

我正在嘗試使用 PHP 通過查詢更新數(shù)據(jù),但數(shù)據(jù)庫中的數(shù)據(jù)沒有變化

PHP
皈依舞 2023-09-22 17:50:00
我正在嘗試使用 PHP 通過查詢更新公司表,但數(shù)據(jù)庫沒有變化。MySQL 數(shù)據(jù)庫。$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 回答

?
慕無忌1623718

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



查看完整回答
反對 回復(fù) 2023-09-22
?
繁星coding

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'");


查看完整回答
反對 回復(fù) 2023-09-22
  • 2 回答
  • 0 關(guān)注
  • 148 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號