PHP Classes
elePHPant
Icontem

Query To JSON: Convert MySQL query results to JSON format

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2008-06-08 (7 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 1,363 All time: 2,688 This week: 1,189Up
Version License PHP version Categories  
querytojson 0.1BSD License5.2PHP 5, Databases, Text processing, Da...
Description Author  

This is a very simple class that converts data from MySQL query result to JSON format.

It executes a given MySQL query and extracts the results into a single array.

The class calls the PHP function json_encode to return a string with the whole result set data in the JSON format.

Picture of L Bharti
Name: L Bharti <contact>
Classes: 1 package by
Country: United States United States
Age: ???
All time rank: 1816238 in United States United States
Week rank: 1621 Up186 in United States United States Up

Details provided by the author  
Author : Loknath Bharti
Email : lbharti at gmail dot com

class : QueryToJson
Functions

queryToJson($result, $header) :
It converts the mysql query result into a JSON string with $header 
as the top header with column header as the header for other data values

Arguments : 

	$result : mysql result returned by mysql_query()
	$header : top header of the JSON object

Return : the JSON string

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example example
Plain text file queryToJson.class.php Class class
Accessible without login Plain text file README Doc. README

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,363All time:2,688
 This week:0This week:1,189Up