<?php
include("MYSQL2JSON.class.php");
//MySQL connect
$c = mysql_connect("localhost", "root", "");
mysql_select_db("mysql");
#
# All JSON syntax are referred in this site: http://www.json.org/example.html
#
//Start:
$json = new MYSQL2JSON(); //Create an object
print $json->query("SELECT user FROM user WHERE user = 'pma';");
//It will print: {"result": {"user":"pma"}}
print $json->query("SELECT user FROM user;");
//It will print: {"result": [{"user":"civicrm"},{"user":"discuz"},{"user":"drupal"},{"user":"gallery2"},...,{"user":"root"}]}
?>
|