PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Daniel Andres Marjos   classMySQL   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Documentation
Class: classMySQL
A simple class to access MySQL Databases
Author: By
Last change:
Date: 21 years ago
Size: 2,838 bytes
 

Contents

Class file image Download
The db_mysql is based in a superclass (db_layout) which will be the base for other database implementations. The properties of db_MySql are: $db_result: Internal. It holds the result of a query $db_affected_rows: It holds how many records (row) were affected by the last query $saved_results: Internal. An array with the results Used by PushResults and PopReslts (see below) $results_saved: Internal. An index pointer. The Methods: error(string [where],string error,string errno) : This is an internal function. It halts the script execution upon error error_msg(): Returns the last MySql error. PushResults(): Saves the last operation result in the internal stack. Used to keep track of the operations in a single instance of the class. PopResults(): Retrieves de las result in the stack. db_mysql(string host, string user, string passwd, string db, string [create]): The class Constructor. The create parameter is a flag that indicates if the class should attempt to create the database if it doesn't exists. reselect_db(string db): Internal. Used tu rebuild the internal database handler to the specified database. closeDB(): Closes the database. create_table(string tblName,mixed tblStruct) Tries to create the table. tblStruct can be a string or an array,. The format of the array if plain. No keys are precessed and each element should represent a mysql field definition. drop_table(string tblName): Drops a table. raw_query(string sql_stat): This is a function that allows a raw query. Useful to perform a migration from old applications that doesn't use a class. count_records(string table,string [filter]): returns how many records meets the condition specified in filter select(string fields,string tables,string [where], string [order_by], string [group_by],string [having], string [limit]): Allows to select records. list_tables(): returns the tables in the database tablename(resource tables, int tbl) Retrieves the name of table tbl insert_id(): the autoincrement value of the last insert. insert(string table,mixed [fields], mixed [values]): Inserts a record in the table. the parameters fields and values can be comma delimited strings or arrays update(string table,string newvals,string [where]): Updates a table delete(string table,string [where]): deletes records free(): dispose the last mysql result. fetch_row(): returns an array with keys [0]...[n] with each field in the resultset result(int recno,string field): returns the content of the field in record recno num_fields(): returns how many fields are in the resultset fetch_array(): returns an array in the format [fname]=value fetch_field(): returns the next field --------------- This class was intended to encapsulate the mysql_* functions.