pquery('select date, type, status, direction, error from sp_commercetranzaction ' . 'WHERE `date` > (NOW() - INTERVAL ? DAY)', array(30)); //$result = $db->query('select date, type, status, direction, error from sp_commercetranzaction'); $entries = array(); while($row = $db->fetchByAssoc($result)) { $entry = array(); $entry[] = $row['date']; $entry[] = $row['type']; /* To display message - not number */ if( $row['status'] == 1 ) { $entry[] = "success"; } else { $entry[] = "error"; } $entry[] = $row['direction']; $entry[] = $row['error']; $entries[] = $entry; } return $entries; } }