I am trying to get the number of rows from MySQL statement and create an if-else statement. However, I tried my times but it doesn't seem to be working. Can anybody tell me what am I doing wrong? or is there any better way to do this.
PHP :
    $sqlquery_str = "SELECT * FROM Promotions WHERE membershipType = :membershipType AND promoStatus = '1' AND CONVERT(datetime, startDate, 103)  <= convert(varchar(8), GETDATE(), 112) AND CONVERT(datetime, endDate, 103)  >= convert(varchar(8), GETDATE(), 112) AND startTime <= CONVERT(char(5), GETDATE(),108) AND endTime >= CONVERT(char(5), GETDATE(),108)";
    $number_of_rows =  mysql_fetch_array($sqlquery_str);
    $total = $number_of_rows[0];
If else statement:
    if (!$results){
        logError('SQL Query failed',print_r($conns->errorInfo(),true));
        echo '
        <b>There was an error retrieving the information for the selected event. Please contact the administrator for further advice.</b>';
        } 
    else if ($total == 1){
        echo "There is an error";
        echo "<br />";
        }
    else {
       $DOMstr = "<h1 class='post-title'>".$results['titlePromo']."</h1>";
        } 
 
     
     
    