Displaying message when no results found in PHP MySQL search

前端 未结 8 1966
独厮守ぢ
独厮守ぢ 2020-12-11 07:07

I have a PHP search script which queries a MySQL database. Currently, when no results are displayed the script shows and error. How can I make it display a message like \"No

8条回答
  •  难免孤独
    2020-12-11 07:42

    if (empty($results)) { 
        echo 'No results found'; 
    } else {
        echo implode($results);
    }
    

提交回复
热议问题