?> </dt> <dd> <?php //first check if this is a serialized value $items = @unserialize($value); if ($value !== '') { if ($items !== false) { $val = null; foreach ($items as $key => $item) { $val .= $key . ", "; } echo substr($val, 0, -2); } elseif ($input_type === 'date') { //then check if it's a date echo sql_date_to_us_date($value); } else { echo $value; } } else { echo "<br />"; } ?> </dd> <?php } } ?> </dl>
} while ($result = $case_query->fetch(PDO::FETCH_ASSOC)) { $rows = array(); //loop through results, create array, convert to json foreach ($cols as $col) { //First look for fields containining serialized arrays //and convert to strings $data = @unserialize($result[$col]); if ($data !== false) { $make_string = null; foreach ($data as $key => $value) { $make_string .= "{$key}, "; } $result[$col] = rtrim($make_string, ' ,'); } //Then check for rows containing dates if (preg_match('/^(\\d\\d\\d\\d)-(\\d\\d?)-(\\d\\d?)$/', $result[$col])) { $result[$col] = sql_date_to_us_date($result[$col]); } $rows[] = $result[$col]; } //Return aaData object to DataTables $output['aaData'][] = $rows; } //If no rows found, return empty array if ($case_query->rowCount() < 1) { $output['aaData'] = array($cols); } $json = json_encode($output); echo $json; }