Quote:I try to add if elements after foreach to print the `else` echo, but the value become an array. How to solve it?
if (count($ListCriteria > 0)){ $i = 0; foreach ($ListCriteria as $key => $value){ $i++; if ($value['still_open']){ } else{ echo 'date closed'; } } }
$ListCriteria = array(); $mySQL = 'SELECT C.id, C.assessment_performance_id, C.title, C.description, C.justification, B.staff_sv_start_date, B.staff_sv_end_date FROM assessment_performance A INNER JOIN assessment_year B ON A.assessment_year_id = B.id INNER JOIN assessment_performance_sectiona C ON A.id = C.assessment_performance_id WHERE C.assessment_performance_id = "'.$data['id'].'" ORDER BY C.id'; $result = mysql_query($mySQL); if ($result){ if (mysql_num_rows($result) > 0){ while ($row = mysql_fetch_assoc($result)) { $ListCriteria[$row['id']]['title'] = $row['title']; $ListCriteria[$row['id']]['description'] = $row['description']; $ListCriteria[$row['id']]['justification'] = $row['justification']; $ListCriteria[$row['id']]['still_open'] = false; if (date('Y-m-d') >= $row['staff_sv_start_start'] && date('Y-m-d') <= $row['staff_sv_end_date']){ $ListCriteria[$row['id']]['still_open'] = true; } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)