Displaying message when no results found in PHP MySQL search

前端 未结 8 1955
独厮守ぢ
独厮守ぢ 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:35

    Try the following:

    {$row['description']}
    {$row['url']}
    "; } echo implode($results); } } ?>

    Also please either use MySQLi or PDO as it is safer and better to use, some information can be found below. Personally I prefer MySQLi but prepared statements in PDO is really good and saves some lines of code every time you query ;)

    MySQLi and PHP

    PDO and PHP

提交回复
热议问题