tags:

views:

31

answers:

1

Any suggestions to show user messages, Something to avoid a lot of if/else statements.

if($row->num_rows > 1) {
  ok
 } else { 
print "There is no...";
}

thanks!

+1  A: 
$err = array();
if(!$row->num_rows > 1) {
 $err[]= "There is no...";
}
...
if (!$err) {
  //ok. doing stuff
} else {
  foreach ($err as $message) {
    echo $message."<br>\n";
  }
}
Col. Shrapnel