亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

PHP 無法在滿足條件后回顯文本

PHP 無法在滿足條件后回顯文本

PHP
慕斯王 2023-07-21 18:10:30
我沒有從下面的代碼中得到所需的結果。一切正常,但有一個主要問題:當數據庫中沒有歌曲時,它僅通過后退按鈕顯示空結果。它無法顯示回聲“抱歉!” 我們的數據庫中沒有這首歌。我不知道錯誤在哪里。所以請幫忙。提前致謝?。。?lt;?php// Php code that fetches audio from the database in server and shows the audio files with singers available for the submitted data// In submission page DROPDOWN consists of Playlist name and TEXTBOX allows to type the song number for that playlist.// Standard format for the audio file stored in the databse is Songnumber-Playlistname-Singer's Shortname.mp3// MP3 files will be inside the AUDIO folder and this PHP code runs from the root folder where there is index.html file for data submission.// Valid song Numbers of Each Playlists that user choose$validsongnumbers = [    'Rock' => 3,     'Pop' => 5,     'Jazz' => 6];// Data captured from dropdown submitted by a user in homepage $PlaylistName = $_POST['Dropdown'];$songNumber = $_POST['songnumber'];// Check the playlist existsif (!array_key_exists($PlaylistName, $validsongnumbers)) {    echo 'Invalid playlist provided.';    exit;}// Check the song number is not greater than what is allowedif ((int)$songNumber > $validsongnumbers[$PlaylistName]) {    echo  'Invalid song number provided.';    exit;}
查看完整描述

1 回答

?
守著星空守著你

TA貢獻1799條經驗 獲得超8個贊

首先,你將“if if”加倍:

if if(count($files) < 0

其次,文件數量永遠不能為負。您應該比較 number 是否等于 0(零),而不是小于 0。

更新:

還是錯誤的代碼:

if ($count=0)

這不是比較,而是賦值。您給出的 $count 值為 0。為了進行比較,您必須使用:

if ($count == 0)


查看完整回答
反對 回復 2023-07-21
  • 1 回答
  • 0 關注
  • 149 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號