How can I set up a condition in this code that displays something like "There is currently nothing posted. Please check back later." if nothing is retrieved or entered in? Currently if nothing was retrieved or entered it just displays nothing at all on the front end. So I would like to put a message in place of nothing at all instead.
if($seasontype=="pending"){
$result = " SELECT * FROM ".$wpdb->prefix."bidsys_picklist WHERE sport = ".$sport." AND pick_result='PENDING' ORDER BY game_date DESC";
$newmeta = $wpdb->get_results($result);
$resultvals = "";
foreach($newmeta as $data){
$game_details="";
$hometeam = "";
$visitorteam = "";
if(trim($data->game_details)!="")
$game_details = $data->game_details;
if($data->visitorteam!=""){ $visitorteam = "<br /><strong>Visitor Team:  </strong>".$data->visitorteam.""; }
if($data->hometeam!=""){ $hometeam = "<br /><strong>Home Team:  </strong>".$data->hometeam.""; }
$gamedate = strtotime($data->game_date);
$gametime = $data->game_time;
$endtime = strtotime('+30 minute',$gametime);
$nowtime = date('Y-m-d h:i:s');
$resultvals = $resultvals."<table class='inner_result'>
<tr class='hdr_3'>
<td colspan='4' >".date("n-d-Y",$gamedate)."<br />
".$gametime."
".$hometeam."
".$visitorteam."
<br /><div class='todays_pick' ><span><strong>Pick:</strong></span>  ".$data->your_pick."<br /><span><strong>Odds:</strong></span>  ".$data->pick_odds." </div>
<br /> ".$game_details."</td>
<td><br />Recommended Unit Play (Risk)<br />
<div class='todays_units' >".$data->units_play." Units</div>
</td>
</tr>
<tr>
</tr>
</table>";
}
echo $resultvals;
}
if (empty($resultvals)) {
echo 'There are no results';
}
Get number of rows returned and check if rows are greater than 0
if($wpdb->num_rows>0){
echo "Your all posts";
}else{
echo "Nothing posted";
}