最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

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

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

PHP
皈依舞 2023-09-22 17:50:00
我正在嘗試使用 PHP 通過查詢更新公司表,但數(shù)據(jù)庫(kù)沒有變化。MySQL 數(shù)據(jù)庫(kù)。$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)驗(yàn) 獲得超4個(gè)贊

您的查詢看起來不錯(cuò),但錯(cuò)誤的數(shù)據(jù)類型、無效的 id 或變量或違反其他約束可能是問題所在。


使用 PDO 語句很好,因?yàn)樗踩?/p>


您可以將代碼修改為,


$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



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

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超4個(gè)贊

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


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

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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