foreach - PHP Only print to table if is not specified value -


i have code populating table using data database query , for-each loop. have status column, can 1 of 4 values - processed, rejected, requested or cancelled.

what need find out how can make table not include value if set processed? ($stat[status]])

any advice on should use working appreciated.

print "<table class='table table-bordered table-striped datatable' style='font-size:0.7em;'>"; print "<thead>";     print "<tr>";         print "<th>id</th>";         print "<th>status</th>";         print "<th>title</th>";         print "<th>first name</th>";         print "<th>last name</th>";         print "<th>position</th>";     print "</tr>"; print "</thead>"; print "<tbody>";  foreach($data $stat)  {     print "<tr>";         print "<td>$stat[id]</td>";         print "<td>$stat[status]</td>";         print "<td>$stat[title]</td>";         print "<td>$stat[firstname]</td>";         print "<td>$stat[lastname]</td>";         print "<td>$stat[position]</td>";                 print "</tr>"; } 

foreach($data $stat) {     if ($stat[status] === "processed") {         continue;     }      print "<tr>";     .... } 

this way skip 'processed' rows.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -