i have this code
$md_query = "SELECT * FROM table ORDER BY id ASC";
$md_result = mysql_query($md_query, $con);
header('Cache-Control: no-cache, must-revalidate');
header('Content-type: application/json');
while($md_row=mysql_fetch_array($md_result))
$data_row = array(
'id' => $md_row['id'],
'type' => $md_row['type'],
'title' => $md_row['title'],
'content' => $md_row['content'],
'author' => $md_row['postedby'],
'post_date' => $md_row['posteddate'],
'publish' => $md_row['publish']
);
print json_encode($data_row); `
but I only show 1 record… does anyone how to fix this?
You need to encapsulate your row-records like {row1: {a:b, b:c}, row2:{e:f, g:h}}
For more examples also see:
http://json.org/
http://json.org/example.html