Category : arrays

Let’s say I have a FormBuilder class that creates forms on the fly using PHP code. It uses pre-defined variables and CSS, all that, to ensure everything is hunky dory, all accessed/manifested through simple bits of code. What are the pros/cons/differences between the following two methodologies to provide its content (in this case form content) ..

Read more

In my codeigniter 3 app logs folder I am seeing the folowing error; ERROR – Severity: Notice –> Trying to get property ‘title’ of non-object C:xampphtdocsmyappapplicationcontrollersForm.php 31 The line in my controller contains; public function view($form_slug) { $form_name = str_replace(‘-‘, ‘ ‘, $form_slug); $form_data = $this->Form_model->getFormByName($form_name); $data = array( ‘title’ => $form_data->title // <– line ..

Read more

How to used the id which got using GET method i want to match that id by searching array which i provided to edit that data and make it a new one <?php $json = file_get_contents(‘data.json’); $json = json_decode($json,true); $user_id=$_GET[‘id’]; echo "$user_id<br>"; // $new = array_keys($json); echo "<pre>"; echo print_r($json); echo "</pre>"; if ($user_id == ..

Read more

MySql Query: $query = $this->db->query("SELECT coalesce(bom_part.stock_deduct, 1) as stock_deduct, bom_part.GRN_Heat_no, bom.part_id FROM planning_part_list as bom LEFT JOIN bom_part_assign as bom_part ON bom_part.BOM_id=bom.id WHERE batch_id=’$batch’ AND sr_no=’$sr_no’ ORDER BY bom.part_id"); $result = array(); foreach($query->result_array() as $key => $values) { $result[$key] = array_values($values); } return $result; Query result in the phpMyadmin: Below is the result in the ..

Read more

I’m not 100% sure about the title (something is missing), but I’m 100% sure what output I need. $A = array(‘0’ => ‘1451’, ‘1’ => ‘1451’, ‘2’ => ‘1452’, ‘3’ => ‘1452’, ‘4’ => ‘1453’, ‘5’ => ‘1453’, ‘6’ => ‘1457’, ‘7’ => ‘1460’); $B = array(‘0′ => ’22’, ‘1’ => ’23’, ‘2’ => ’22’, ..

Read more

I have two arrays in PHP: Array 1 Array ( [0] => Array ( [autoid] => t35wmkbg [task] => Zaphod [progress] => incomplete ) [1] => Array ( [autoid] => cwg2yc5q [task] => Arthur [progress] => incomplete ) [2] => Array ( [autoid] => 85q4bcmy [task] => Ford [progress] => incomplete ) [3] => Array ..

Read more

where i want to sort it. following array.. $a = array( (int) 152 => array( ‘id’ => ‘152’, ‘name’ => ‘Grade 3: Unit #1: erewtrewt’, ‘sortByFld’ => ‘103’ ), (int) 168 => array( ‘id’ => ‘168’, ‘name’ => ‘Grade 3: Unit #20: ##Media## worksheet’, ‘sortByFld’ => ‘2003’ ), (int) 94 => array( ‘id’ => ’94’, ..

Read more