PHP Classes

File: example.php

Recommend this page to a friend!
  Packages of Adnan Siddiqi   MySQL to JSON   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: MySQL to JSON
Convert data from MySQL query results into JSON
Author: By
Last change: Change in Email Address
Date: 16 years ago
Size: 591 bytes
 

 

Contents

Class file image Download
<?
/** 
* Filename: example.php 
* Purpose: Example file which is utilising mysql2json class
* Author: Adnan Siddiqi <kadnan@gmail.com> 
* License: PHP License 
* Date: Tuesday,June 21, 2006 
*
*/
include("mysql2json.class.php");
//this is db connection file and has nothing to do withe the class itself
require("dbcon.php");
?>
<?
$num=0;
//any SQL select Query
$sql="select * from students s";
$result=@mysql_query($sql) or die(mysql_error());
$num=mysql_affected_rows();
//calling class
$objJSON=new mysql2json();
print(trim($objJSON->getJSON($result,$num)));
?>