I have two foreach loops to display some data, but I want to use one foreach based on the database result.
means that if any row is returned from the database, then it
forach($first as $fk=>$fv)must be executed otherwise it
foreach($other as $ok)must be executed. im unsing below ternary operator that gives parsing 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 this state with the ternary operator or any other idea.
thank
source
share