Return mysql records in json format - Php

get json from mysql

Snippet Code


  
Rate this page :
  [ 0 votes]

Use the above function to select data from mysql table and return them as json. when used with ajax, u can use the json object to parse, display and process.

$qry = "select id, name, address from cust "; $ret = mysql_query("$qry",$link); $xx = mysql_fetch_all($ret); if($xx) echo json_encode($xx);

Tags


Ask Questions

Ask Question