PHP Classes

File: sqladm_example.php

Recommend this page to a friend!
  Classes of Erh-Wen,Kuo  >  sql2table  >  sqladm_example.php  >  Download  
File: sqladm_example.php
Role: ???
Content type: text/plain
Description: Providing a example to demo how to use "SqlAdmStart()" for managing a mysql table
Class: sql2table
Easy way to display Mysql sql content.
Author: By
Last change:
Date: 19 years ago
Size: 2,483 bytes


Class file image Download
	 * @version V1.1 2002/July/12 (c) Erh-Wen,Kuo ( All rights reserved.
	 * Released under both BSD license and Lesser GPL library license. 
	 * Whenever there is any discrepancy between the two licenses, 
	 * the BSD license will take precedence. 
	 * purpose: providing a example how to use "SqlAdmStart()" displaying well format html form
	 *          with "Insert","Edit","Delete" link on the table.
	/* New class method:SqlAdmStart() is implemented at V1.1,2002/July/12 */
	//Base on $action varaible to switch different process
		case "delete":
			//put your "delete" action code here
			echo"Action is 'Delete'";
		case "insert":
			//put your "insert" action code here
			echo"Action is 'Insert'";
		case "edit":
			//put your "edit" action code here
			echo"Action is 'Edit'";
			//include sql2table class
			//setup parameters for initiating Sql2Table instance
			//modify your mysql connection parameters & database name
			//create a new instance of Sql2Table class
			$obj=new Sql2Table($db_host,$db_user,$db_pwd,$db_dbname);
			//setup the page display limit
			//initiate $offset variable is necessary
			/*Below is the key portion of this method,"SqlAdmStart()" would need at least 3 parameters
			  1.the script name,which would handle the action when user click the link
			  2.the keyfield of your table,for example "customer_id" in "customer" table.(should be unique)
			  3.qry string,which shows the records
			  This example script would handle all the action in the same script.But you could deside using
			  another script file to handle "Delete","Insert" or "Edit" action.
			//the query string you want to show
			//you could update below $query to suit your need
			$query="Select * From $targettable";
			//SqlAdmStart() is the main class method to do the trick		
			//ShowTable() method would return a string combine Pages,Navigation&Sql Content
			//in HTML table format. Easy for debugging!!
			echo $obj->ShowTable();
	}//switch($action) END
For more information send a message to info at phpclasses dot org.