PHP Classes

Convert MySQL tables to PHP class: Generate code to access MySQL records as objects

Recommend this page to a friend!

  Author Author  
Picture of Rafael Rocha
Name: Rafael Rocha <contact>
Classes: 1 package by
Country: Portugal Portugal
Age: 36
All time rank: 84911 in Portugal Portugal
Week rank: 485 Up10 in Portugal Portugal Up

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can be used to generate code to access MySQL records as objects.

It accesses a given MySQL database and retrieves the list of tables and information about the respective table fields.

The class can generate code for classes that can be used to access the respective MySQL table records as if they were objects.

The generated classes can have getter and setter functions for each table field, functions to insert or update records with the object values, functions to load a record with a given identifier, and delete the object record.

 * Author: Rafael Rocha - - - or for any question - EN and PT
 * Date: 26.04.2009
 * Version: 1.1
 * License: LGPL 
 * What do: This is a class to convert your mysql
 * tables into php classes.


I-What do?
II - Install
III - How to use functions
IV - About author
V - Bugs Fixed and Other important things

I - What this class do?***************************

Run index.php, set the mysql connection settings. This will be convert all your tables into php classes.
For exemple you have table: Users, Products. You will have users.class.php and products.class.php. With 
getters and setters and other nice functions. Any question

II - Install ***************************

Just run index.php and put in the Textfields mysql information. Make sure that file directory is 777CHMOD.

III - How to use functions ***************************

After you have all of your classes put them into library folder FOR EXAMPLE: (just a example)



in public_html/index.php use:

require '../users.class.php';
require '../products.class.php';

Now you can use!

$Classe_user = new users(); // use to connect to mysqli with class DataBaseMysql.class.php 

//Load user id=4 *******


//OK! now you can use that by getfunction. You can have all information in ROW id=4!

echo $Classe_user->getName();
echo $Classe_user->getPassword();


$Classe_user->New_user("Rafael", "pasword"); //you had clear by reload new information into variable

$Classe_user->Save_Active_Row_as_New(); // save this new user as a new in table

//Set Function ANd Save_active_row() *******

$Classe_user->Load_from_key(4); //all information about id=4

$Classe_user->setName = ("John"); // Rafael -> John (same password yet!)

$Classe_user->Save_Active_Row(); // UPDATE row in table

//Delete_row_from_key($key_row){} *******

$Classe_user->Delete_row_from_key(4); //delete row that have id=4.

//GetKeysOrderBy($column, $order) *******

$keys = $Classe_user->GetKeysOrderBy("name", "desc");  // array of keys order by name desc. You can put asc

	for($i=0; $i!=sizeof($keys); $i++){ run all the array
	   $Classe_user->Load_from_key($keys[$i]); // possicion in key array, to load information
		echo $Classe_user->name; //right information, with orther by name desc.
//you see that just a simple for and array off keys, you can have all users information simplY!!!

IV - About Author **********************

Rafael Rocha is from Póvoa de Santo Adrião > Odivelas > Lisboa > Portugal
Study in ISCTE LISBON engº informatica or for any question - EN and PT -> to libraries

V - Bugs fixed and other important things

 * Bugs fixed in 1.1: 
 * 1º Mysqli query function
 * 2º Save as new function on classes
 * Bugs still hapen:
 * 1º table keys in end of table missing. So don´t let your table keys in end of table fields
 IMPORTANT: This classe use mysqli classe, that just php 5.0 have! if you don´t have mysqli function, you need to install manual.

  Classes of Rafael Rocha  >  Convert MySQL tables to PHP class  >  Download Download .zip .tar.gz  >  Support forum Support forum (10)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: Convert MySQL tables to PHP class
Base name: mysql_
Description: Generate code to access MySQL records as objects
Version: 1.2
PHP version: 5
License: GNU Lesser General Public License (LGPL)
All time users: 3744 users
All time rank: 876
Week users: 0 users
Week rank: 200 Equal
  Groups   Rate classes User ratings   Applications   Related pages   Files Files  

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Databases Database management, accessing and searching View top rated classes
Group folder image Code Generation Compilers and tools that generate code automatically View top rated classes

  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Good (81%) Good (88%) Sufficient (70%) Sufficient (79%) - - Sufficient (64%) 874
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Related pages  
Class main page
Class main page

  Files folder image Files  
File Role Description
Files folder imagedemo (4 files)
Accessible without login Plain text file Index.php Example Index to run
Plain text file SQL_to_PHP.class.php Class SQL to PHP class
Accessible without login Plain text file ReadmeEN.txt Doc. Documentation

  Files folder image Files  /  demo  
File Role Description
  Plain text file DataBaseMysql.class.php Class Data Base Connection Class
  HTML file index.php Class Main page
  Accessible without login Plain text file Readmefirst.txt Conf. Read me file
  Plain text file users.class.php Class user class

Install with Composer Install with Composer - Download Download all files: mysql_.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.