Category : arrays

I have the following output when printing an array called yestardayArray using print_r: Array ( [project-id] => Array ( [373482] => Array ( [responsible-ids] => Array ( [129938] => Array ( [0] => Array ( [task-id] => 1812 [content] => HU-003 – FRONT [progress] => 100 [completed_On] => 2020-10-23 [created_On] => 2020-10-14 [responsible-ids] => 129938 ..

Read more

i want to insert JSON data in single column in Mysql with PHP <input type="text" name="text1" /> <input type="text" name="text2" /> $jsondata = ‘[{"value1":{ "text":"text1", "text2":"text2"},"value1":{ "text":"text1", "text2":"text2"}}]’; INSERT INTO tablename (row) VALUES ($jsondata); it’s possible or We can generate a JSON file then import please guide me Thank you Sourc..

Read more

I am performing an insertion of values ​​using an api. then, I send the values ​​correctly and get the return on the same page. Eg: <?php … $return= $set->createCharge([ ‘description’ => ‘Strings etc…’, ‘amount’ => 10.0 )]; print_r($return); ?> This print_r Result is: stdClass Object ( [data] => stdClass Object ( [charges] => Array ( ..

Read more

I’m new to PHP and I tried to print array values vertically but it shows values horizontally. This is the code that I tried. Please help me, guys. $roomCount = count($_POST["room_nos"]); for($i=0;$i<$roomCount;$i++) { foreach($roomsCount as $value){ } $output.= $roomsCount[$i]; } echo $output; Current output is 120122. But I want it as 120 122 Really waiting ..

Read more

i have two multidimensional arrays like this $firstNumbers = $Numbers[0]; $secondNumbers = $Numbers[1]; contents of these arrays are $Numbers[0][0] = 1; $Numbers[0][1] = 2; $Numbers[0][2] = 3; $Numbers[0][3] = 4; $Numbers[0][4] = 5; second array $Numbers[1][0] = 3; $Numbers[1][1] = 4; $Numbers[1][2] = 5; $Numbers[1][3] = 6; $Numbers[1][4] = 7; I need to iterate these ..

Read more

How to create array in array in easiest way better if use 1 query and get the output array in array This is my query to get coordinates y and x $get_coordinate_y = Location:: select(‘middle_point_y’) ->where(‘id_loc’, $id_loc) ->pluck(‘middle_point_y’); //output: [20,30,55] $get_coordinate_x = Location:: select(‘middle_point_x’) ->where(‘id_loc’, $id_loc) ->pluck(‘middle_point_x’); //output: [45,50,76] From 2 queries above I’ve 2 ..

Read more

I am stuck trying to write a logic in my CI application. The scenario is I have the following code in my model class function getNameFromDatabase($name) { $query = $this->db->get_where(‘user’, array(‘name’ => $name)); if ($query->num_rows() > 0){ return $query->result(); } else { return false; } } In my Controller I use this method and I ..

Read more

When I am passing this function I am getting $sql1 = "UPDATE `users` SET `stuff` = ‘$stuff_array’ WHERE `users`.`id` = $id;"; $result = mysqli_query($conn, $sql1); if ($result) { echo "ok"; } this is error I am getting: Array to string conversion in C:xampphtdocsphp_projecttq_pg.php on line 76 Please tell me solution to this Sourc..

Read more