Category : loops

I’m actually working in php with codeginiter and mysql as DB. I’m trying to do a select with treeview. I have the following function to get the root category and his children categories: function get_treeview_groups($groups_category){ $CI = &get_instance(); $CI->load->model("service_desk/Service_desk_model",’service_desk_model’); foreach ($groups_category as &$valor) { $arr = []; if($valor["root"] == 1){ $parentGroup["id"] = $valor["groupid"]; $parentGroup["title"] = ..

Read more

I have a problem for my program. this my script.. $x=1; $no=1; $tot=0; $bobot=0; $jumlah=4; for($i=1;$i<=$jumlah;$i++) { <tr> <th> echo $no++; </th> for($a=$i;$a<=$jumlah;$a++) { echo "<td>".$x/$a."</td>"; } <td>Count</td> </tr> } and this is my result result page I want to replace the words "count" with the sum of each column in the same row. and ..

Read more

foreach ($fileContent as $stData){ while(!feof($f)) { $stData = explode(‘,’, trim(fgets($f, 1024))); if ((filter_var($stData[1], FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>100))))&& preg_match(‘/^d{8}$/’, $stData[0])){ echo $stData[0]. " : " . $stData[1]. "</br>"; $goodStudents[] = $stData; }elseif ((filter_var($stData[1], FILTER_VALIDATE_INT, array("options" => array("min_range"=>0, "max_range"=>100)))==false)&& preg_match(‘/^d{8}$/’, $stData[0])) { echo $stData[0]. " : " . $stData[1]. " : Incorrect mark : not included ..

Read more

I was studying multidimensional arrays in PHP and wanted to try some myself, I manage to loop through a 2-dimensional one easily but I get a bit stuck with a 3-dimensional one. here’s my original code $inscrits = [ [ ‘Nom’ =>’Leonos’, ‘Age’ => ’24’, ‘Mail’ =>’[email protected]’ ], [ ‘Nom’ =>’Leodos’, ‘Age’ => ’25’, ‘Mail’ ..

Read more

I use this snippet for display product categories in product loop on Shop and archives pages: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘add_product_cat’, 2); function add_product_cat() { global $product; $product_cats = wp_get_post_terms($product->id, ‘product_cat’); $count = count($product_cats); foreach($product_cats as $key => $cat) { echo ‘<span class="add_product_cat">’ . $cat->name . ‘</span>’; } } I want this: <div class="product_cats"> <span class="add_product_cat">Cat 1</span> ..

Read more