Forums / Cotonti / Development / Help request :: JSON

JSON notation

Kilandor
#24143 2010-04-16 20:20
$sql = sed_sql_query("SOME QUERY");
//echo json_encode($sql); this returns a resource id # because thats what it is a referrence for the results basicly

while($row = sed_sql_fetcharray($sql))
{
  //echo json_encode($row);
  //This would output the data for a row, but yes would not work for multiple rows however you could do this
  $json_data[] = $row;
}
echo json_encode($json_data);
//This would create an array and output it for each sql row such as data.0.sqldata

This may be a little easier, Ez since you do not have to build your own jsonarray

AJAX and json data can be quite nice sometimes. I use it alot in my CLI plugin on my site actually functions completely revolves around AJAX/JS