I have situation . I want to insert one array element to another array element but could not find the exact method.
This is my function
public function get_applicants($sort_array = array('apply_id DESC'))
{
global $wpdb;
$sql = 'SELECT * FROM ' . $this->tableac . " ORDER BY " . implode(',', $sort_array);
//$sql = 'SELECT c. * , p. * FROM wp_apply c, wp_apply_files p WHERE c.apply_id = p.apply_id';
$educations = $wpdb->get_results($sql);
$getid=array();
foreach($educations as $education){
//print_r($education);
$sqlfile = 'SELECT * FROM wp_apply_files WHERE apply_id = '.$education->apply_id;
$getalls = $wpdb->get_results($sqlfile);
$allvalues="";
foreach($getalls as $getall){
$allvalues= $getall->uploaded_file.", ";
$getid[]=$getall->uploaded_file;
}
$allvaluesnew=rtrim($allvalues,", ");
// echo "<br>";
// Here I want to insert getid into educations array
}
echo "<pre>";print_r($educations);
die();
//return array($educations,$getid);
}
print_r result show this.
Array
(
[0] => stdClass Object
(
[apply_id] => 44
[choose_position] => HR Manager
[title] => testr
[first_name] => waqas
[last_name] => aamer
[current_job] => developer
print_r get id show like this.
Array
(
[0] => a75d138911c55df639fdd09fade511151-23.pdf
[1] => newone3.pdf
[2] => a75d138911c55df639fdd09fade511151-22.pdf
[3] => newone2.pdf
[4] => a75d138911c55df639fdd09fade511151 (2).pdf
[5] => newone.pdf
)
I want to insert these these elements iteration wise. When in the educations first iteration comes than it should insert all the elements at one index of second array separated by comma.