I need to get the earliest date and the latest date in the below query. Not sure if the while loop is necessary to achieve this though? I don't need min/max for every tbl_type but the lowest of them all and the highest of them all.
// get min and max date for all the table types
$tbl_types = array(1,7,8);
foreach ($tbl_types as $tbl_type) {
$sql = "SELECT min(logdate) as min_date,max(logdate) as max_date FROM tbl_xxx";
$sql .= " AND tbl_types_id = '".$tbl_type."'";
$result = $this->query($sql);
$item = array();
while ($row = mysql_fetch_assoc($result)) {
array_push($item, $row);
}
$return[]=$item;
}
Cheers!