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 } ?>
nasıl üçlü operatörü veya başka bir fikir aracılığıyla bu durumu işlemek için bana tavsiye lütfen.
Teşekkürler