How do I append arrays to a multidimensional array? When it goes through the loop, it needs to add the data as an array to create multiple arrays. It encodes to json and sends to an Android phone.
Relevant code:
$data = array(
"articles" => array(
array(
'id'=> "4335",
'cat'=> "Lifestyle",
'title'=> "Welcome to field and rural life",
'url'=> "http://www.fieldandrurallife.com"
),
array(
'id'=> "4336",
'cat'=> "Lifestyle",
'title'=> "Thank You",
'url'=> "www.thankyou.com"
)
)
);
while($row = mysql_fetch_array($sql))
{
$id = $row["id"];
$cat = $row["category"];
$title = $row["title"];
$url = $row["url"];
// HOW DO I ADD THIS INTO THE ARTICLES ARRAY??
// array(
// 'id'=> $id,
// 'cat'=> $cat,
// 'title'=> $title,
// 'url'=> $url
// )
}