$sql = "SELECT * FROM `scripts` LIMIT 0, 30 ";
$result = mysql_query($sql) or die ('Error updating database: ' . mysql_error());
$json = array();
if(mysql_num_rows($result)) {
while($row=mysql_fetch_row($result)) {
$json['table data'][]=$row;
}
}
$encoded = json_encode($json);
echo $encoded;
This is my output:
{"table data":[["1","test","30","13"],["2","test2","40","14"]]}
How do I access an individual piece of the array, its an array of arrays? do i decode it first?