mysql fetch array if no results display message

后端 未结 2 994
走了就别回头了
走了就别回头了 2020-12-12 07:39

I am trying to get a database call to show a statement saying no results found if there are no results returned.

How would I go about doing this to my code:-

2条回答
  •  时光说笑
    2020-12-12 07:59

    This needs an IF statement.

    $rows = mysql_fetch_array($getFixtures);
    if(count($rows))
    {
        while ($fixtureData = $rows)
        ...
    }
    else
    {
        echo 'No results found';
    }
    

提交回复
热议问题