Here is my code
foreach ($query1 as $post)
{
foreach ($query2 as $data)
{
if ($post->post_id == $data->post_id)
{
// add all actions from a post to its array
if (!isset($post->post_meta))
{
$post->post_meta = array( strtolower($data->post_meta_key) => $data->post_meta_value );
}
else
{
array_push( $post->post_meta[strtolower($data->post_meta_key)] = $data->post_meta_value );
}
}
}
}
Im not sure how to fix the code. Im not getting the value, only the key, and a few errors.
array_push() expects at least 2 parameters, 1 given
It should print out something like this
[0] => stdClass Object
(
[post_id] => 218
[post_meta] => Array
(
[flagged] => 0
[deleted] => 1
)
)
$post->post_meta
is set, but you are certain that$post->post_meta[strtolower($data->post_meta_key)]
is set? – Lucas Moeskops Aug 11 '11 at 8:30