PHP Classes

File: demo_myquery_report.php

Recommend this page to a friend!
  Packages of Simon Kuriakose   My Query Report   demo_myquery_report.php   Download  
File: demo_myquery_report.php
Role: Example script
Content type: text/plain
Description: demo script
Class: My Query Report
Generate HTML reports from MySQL query results
Author: By
Last change: mysql connection string parameters modified
Date: 22 years ago
Size: 1,711 bytes
 

 

Contents

Class file image Download
<?php
/*******************************************************************
* mydemo.php
* It is a demo program to demonstrate the functioning of the class 
* 'cls_myquery_report.php'.
* 
********************************************************************
Usage (for newbies to mysql)

1. Create a user in MySQL say, 'student' with password say, 'student123'
2. Create a database named say, 'school'
3. Create a table say, 'student' with fields as:
    StudID int
    StudName varchar(30)
    StudMarks int
    DateBirth date
4. Fill in data using insert command
    
5. Copy the files cls_myquery_report.php & mydemo.php into your webserver

6. Execute the php script 'mydemo.php' using your web browser

7. The browser will display the report.

********************************************************************/

require 'cls_myquery_report.php';    //include the class module

$myreport = new MyQueryReport;        // Instantiate QueryReport Class.

// Connect to database parameters are - hostname,username,password,databaseName

$myreport->connect_db("localhost", "student", "student123", "school"); 

$query="select StudID as \"Student ID\", StudName as \"Name\", StudMarks as \"Marks\",".
        " DateBirth as \"DOB\" from student";
    // Use 'as' option in SQL to set proper column heading names. Other wise it will
    // take the default field names as column headings.
    
$title= "STUDENTS DETAILS";     // Title to be displayed on the Report
$color = "yellow";        // Set colour flavour  of Report - Use VIBGYOR colors
                //violet, indigo, blue, green, yellow, orange, red     
$myreport->display_report($query, $title,$color);// Display the Report 
                        //with the query, title & color

?>