(c) 2004 by Anil Jagtap
author - Anil Jagtap
Phone  - +91 9422690458  (mobile)
	 +91 2145 225259 (home)
email  - qt_develop71@yahoo.com
License used for this programe is GNU GPL.

This zip contains
1. dbmagic.php
2. Readme.txt

----------------------------------------
This is a class which builds dataentry, update and delete record
screens for MySQL. Its a tool for peoples who already know a little 
bit PHP. Just include dscreen.php file in your programe, instantiate
the class and enjoy the freedom from coding boaring data screens.


Description about class members( though they are very simple to understand )

screenBuilder( $database, $host="localhost", $user="root", $pass="" )

Its the constructor for the class and need these params 
$database 	- Name of MySQL database 
$host		- Host name serving database
$user		- Username for MySQL database( Default is root)
$pass		- Password for MySQL database( Default is blank password)



getTables() - Returns list of tables in database given in constructor

getFieldList($table) - Returns all fields in $table as array

getFieldTypes($table) - Returns all field types in $table as array

getFieldLen($table)  - Return lengths of all fields in $table as array

getFieldValues($table,$fieldname) - Returns field values of field $field from table $table

close() - Closes link to MySQL


writeFormHTML($table, $host) - Writes data input scren for $table on $host, as well
writes post$table.php file to save that data.

showforUpdate($criteria,$where,$table,$host,$cmd) - Writes 'Update' or 'delete'
screen as per $cmd with $sql where data is $where for $table on $host.
WARNING - $sql is without WHERE clause, use $where to specify WHERE, example
given below.

chopURL($url) - Returns path without filename. ex. http://localhost/sb/test.php 
will return as http://localhost/sb/

Nothing more about it. See some examples given beow.


Thease are some examples how you can use screenBuider class in your
programes:

/* file add.php  */ 

// Adding record in MySQL table

include "dbmagic.php";

<?php
$table = "sometable";
$host = "somehost";

$sb = new screenBuilder("ppc","localhost","user","password");

$text = $sb->writeFormHTML($table,$host);
echo $text;

$sb->close();

?>

That's it and you will see a data entry screen for the given table.

Here is example of updating a record without writing boare update code

/* file update.php  */ 

// Update record in MySQL table

include "dbmagic.php";

<?php
$table = "sometable";
$host = "somehost";

$sb = new screenBuilder("ppc","localhost","root","");

$sb->showforUpdate("SELECT * FROM area", "WHERE Area_code='22'","area","localhost","update");

$sb->close();

?>


And finally deleting record without writing code for delete

/* file delete.php  */ 

// Update record in MySQL table

include "dbmagic.php";

<?php
$table = "sometable";
$host = "somehost";

$sb = new screenBuilder("ppc","localhost","root","");

$sb->showforUpdate("SELECT * FROM area", "WHERE Area_code='22'","area","localhost","delete");

$sb->close();

?>

---------------------------------------------------------
Please do mail me about any comments on it at qt_develop71@yahoo.com
homepage http://geocities.com/qt_develop71

Enjoy!


