how to run foreach loop with ternary condition
- by I Like PHP
i have two foreach loop to display some data,
but i want to use a single foreach on basis of database result.
means if there is any row returns from database then
forach($first as $fk=>$fv) should execute otherwise
foreach($other as $ok) should execute.
i m unsing below ternary operator which gives parse error
$n=$db->numRows($taskData); // databsse results
<?php ($n) ? foreach ($first as $fk=>$fv) : foreach ($other as $ok)
{ ?>
<table><tr><td>......some data...</td></tr></table>
<?php } ?>
please suggest me how to handle such condition via ternary operator or any other idea.
Thanks