PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of L Bharti   Query To JSON   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Query To JSON
Convert MySQL query results to JSON format
Author: By
Last change: Coding error
Date: 15 years ago
Size: 368 bytes
 

Contents

Class file image Download
<?php
/*
 * Example to illustrate the use of the class
 */
//Include the file containing the class
include "queryToJson.class.php";
//perform a query
$result = mysql_query("select * from foo");
//create a new QueryToJson object
$jsonQuery = new QueryToJson;
//Use the function to get the JSON sring
$jsonObject = $jsonQuery->queryToJson($result, "foo");
?>