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!
=-=-=-=-=-=-=
|