PHP Classes
elePHPant
Icontem

13 in a dozen db class: Access MySQL servers and display queries in tables

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2006-08-01 (9 years ago) RSS 2.0 feedStarStarStar 51%Total: 3,857 This week: 3All time: 783 This week: 368Up
Version License Categories  
dozen13 1.0.0Freely DistributableHTML, Databases
Description Author  

This class can be used to access MySQL database servers and display query results in HTML tables.

It can establish database connections to a given MySQL host, retrieve server database information, execute SQL queries, retrieve the inserted identifier by the last INSERT query, get the number of effected rows by a query, get the number of returned rows by a query, get the number of columns in a query result set, retrieve query result rows into arrays or objects.

The class can also generate HTML tables to display query result data or metadata about the query result columns.

Picture of joris visser
Name: joris visser <contact>
Classes: 1 package by
Country: The Netherlands The Netherlands
Age: ???
All time rank: 74522 in The Netherlands The Netherlands
Week rank: 409 Up11 in The Netherlands The Netherlands Up

Details provided by the author  
13-IN-A-DOZEN DATABASE

YES YET AN OTHER DATABASE CLASS

CREATOR: JORIS VISSER

MY FIRST SELF WRITEN CLASS

=-=-=-=-=-=-=
tested under 
PHP 5.1.2
PHP 4.3.6

====
manual

	var $db_HOST = "localhost";
	var $db_USER = "root";
	var $db_PASS = "root";
	var $database = "db"; 
	var $sqlerror = "sql could not be connected"; 
	var $dbc ;

=-=-=-=-=-=-=
normal usage:
<?php
include("db.class.php");
$db = NEW database;
?>
- assigning database class
-- connection to database


=-=-=-=-=-=-=
database()
- standard call
-- connection to database


=-=-=-=-=-=-=
connect_db()
- connect to database


=-=-=-=-=-=-=
query_db($query,$print = false) 
//1. query 
//2. show query (optional)
- preform query
-- show error if could not be executed
- check if query was given
-- show query when $print is given as true


=-=-=-=-=-=-=
close_db()
- close database connection


=-=-=-=-=-=-=
id_db()
- return last given inserted ID


=-=-=-=-=-=-=
affecte_db() 
- return affected rows in db


=-=-=-=-=-=-=
num_rows($q)
1. query
- return number of rows in query

=-=-=-=-=-=-=
num_fields($q)
1. query
- return number of fields from query

=-=-=-=-=-=-=
db_info()
=-=-=-=-=-=-=
fetch_db_row($fetched)
1. result from $db->query_db($query)
- return as mysql_fetch_row

=-=-=-=-=-=-=
fetch_db_array($fetched)
1. result from $db->query_db($query)
- return as mysql_fetch_array

=-=-=-=-=-=-=
fetch_db_assoc($fetched)
1. result from $db->query_db($query)
- return as mysql_fetch_assoc

=-=-=-=-=-=-=
fetch_db_object($fetched)
1. result from $db->query_db($query)
- return as mysql_fetch_object

=-=-=-=-=-=-=
get_table($query,$names='',$url='',$extrafields='')
1. query
2. names for table headers (optional)
3. Give url in field (optional)
4. Extrafields additional to rest of query (optional)
- preform query
-- give error
- makeup given $_GET variables for sorting
- give query back in table form
-- makeup of table can be changed in class.inc.css

Makeup 100% W3C xhtml compatible!

=-=-=-=-=-=-=

  Files folder image Files  
File Role Description
Accessible without login Plain text file CSS Data CSS
Accessible without login Plain text file README Doc. README
Plain text file 13inadozendbclass Class Class rep..

 Version Control Unique User Downloads Download Rankings  
 0%Total:3,857All time:783
 This week:3This week:368Up
 User Ratings  
 
 All time
Utility:75%StarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:62%StarStarStarStar
Examples:-
Tests:-
Videos:-
Overall:51%StarStarStar
Rank:1567