Category : for-loop

The second foreach-function is displayed in every <td> x-Times because of the for-function. What must the second foreach be replaced with so that it is only shown once per <td>? echo ‘<div class="responsive">’; echo ‘<table class="table">’; echo ‘<thead>’; echo ‘<tr>’; echo ‘<th>Bestellung #</th><th>Lieferant</th><th>Vsl. WE</th>’; echo ‘</tr>’; echo ‘<tbody>’; foreach($arr->entries as $order => $value) { echo ..

Read more

How can i add the active class only, just to the first element in this for loop? for($i = 0; $i < $akcios_kepek_num; $i++) { if($i == 1 ) { $active = "active"; } else { $active = ""; } echo ‘<li data-target="#carousel-example-3" data-slide-to="’.$i.’" class="’.$active.’"></li>’; } I tryed to check it, with the $i == ..

Read more

I want to do it with a single statement using for Loop but it’s not working. Here is the code: $subcat = Sub_Category:: select(‘id’,’name’)->where([‘category_id’=>$iddata[0]->id])->get(); $subcat1 = Sub_Category:: select(‘id’,’name’)->where([‘category_id’=>$iddata[1]->id])->get(); $subcat2 = Sub_Category:: select(‘id’,’name’)->where([‘category_id’=>$iddata[2]->id])->get(); $subcat3 = Sub_Category:: select(‘id’,’name’)->where([‘category_id’=>$iddata[3]->id])->get(); $subcat4 = Sub_Category:: select(‘id’,’name’)->where([‘category_id’=>$iddata[4]->id])->get(); i am doing like this but its not working: $length =sizeof($iddata); for($i=0;$i<$length;$i++) { $subcat = ..

Read more