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

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

PHP 如果變量 = a 而不是 = b

PHP 如果變量 = a 而不是 = b

PHP
慕萊塢森 2023-05-12 15:52:36
PHP 7.3.18MySQL 5.7.30這是相關(guān)的代碼,它立即失敗,所以我很感激它被糾正。第一個“如果”沒問題,但問題出在第二個和第三個。$targetcatid2、$targetcatid3、$targetweight2、$targetweight3 已正確聲明。目的是如果產(chǎn)品屬于 Category2 而不是 Category3,則重量將變?yōu)?Weight2,反之亦然。$row2=mysqli_fetch_array($select2);if($row2['category_id']== $targetcatid){    $row['product_weight']= $targetweight;}if($row2['category_id']== $targetcatid2 && !== $targetcatid3){    $row['product_weight']= $targetweight2;}if($row2['category_id']== $targetcatid3 && !== $targetcatid2){    $row['product_weight']= $targetweight3;}我最近的努力是:如果($row2['category_id']== $targetcatid){ $row['product_weight']= $targetweight; }如果($row2['category_id']== $targetcatid2 && $row2['category_id']!== $targetcatid3){ $row['product_weight']= $targetweight2; }elseif($row2['category_id']== $targetcatid3 && $row2['category_id']!== $targetcatid2){ $row['product_weight']= $targetweight3; }elseif($row2['category_id']== $targetcatid2 && $row2['category_id']== $targetcatid3){ $row['product_weight']= $targetweight3; }我發(fā)現(xiàn)新條件不起作用,即使是單獨使用也是如此。但是不明白為什么:elseif($row2['category_id'] == $targetcatid2 && $row2['category_id'] == $targetcatid3){ $row['product_weight'] = $targetweight3; }
查看完整描述

1 回答

?
HUX布斯

TA貢獻(xiàn)1876條經(jīng)驗 獲得超6個贊

您沒有正確理解 && 運算符。

而不是這個

if($row2['category_id']== $targetcatid2 && !== $targetcatid3){

您應(yīng)該分別比較條件。

if($row2['category_id']== $targetcatid2 && $row2['category_id'] !== $targetcatid3){


查看完整回答
反對 回復(fù) 2023-05-12
  • 1 回答
  • 0 關(guān)注
  • 132 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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