I'm using a foreach loop to create an array from database values like so:
foreach ($query->result_array() as $row) {
array(
'user_id' => $user_id,
'post_id' => $row['id'],
'time' => '0',
'platform' => $platform
);
}
Let's say I pull 2 rows, I need to make this foreach create a multidimensional array in the following format:
$data = array(
array(
'user_id' => '12',
'post_id' => '37822',
'time' => '0',
'platform' => 'email'
),
array(
'user_id' => '12',
'post_id' => '48319',
'time' => '0',
'platform' => 'email'
),
);