//
Sourceforge:breaking down the barriers to Open Source development
Copyright 1999-2000 (c) the SourceForge Crew
Http://sourceforge.net
//
$Id: database.php,v 1.6 2000/04/11 14:17:13 CVS Exp $
//
/etc/local.inc includes the machine specific database connect info
function Db_connect () {
Global $sys _dbhost, $sys _dbuser, $sys _dbpasswd;
$conn = mysql_connect ($sys _dbhost, $sys _dbuser, $sys _dbpasswd);
if (! $conn) {
Echo Mysql_error ();
}
return $conn;
}
function Db_query ($qstring, $PRint =0) {
Global $sys _dbname;
Return @mysql ($sys _dbname, $qstring);
}
function Db_numrows ($qhandle) {
Return only if Qhandle exists, otherwise 0
if ($qhandle) {
Return @mysql_numrows ($qhandle);
} else {
return 0;
}
}
function Db_result ($qhandle, $row, $field) {
Return @mysql_result ($qhandle, $row, $field);
}
function Db_numfields ($lhandle) {
Return @mysql_numfields ($lhandle);
}
function Db_fieldname ($lhandle, $fnumber) {
Return @mysql_fieldname ($lhandle, $fnumber);
}
function Db_affected_rows ($qhandle) {
return @mysql_affected_rows ();
}
function Db_fetch_array ($qhandle) {
Return @mysql_fetch_array ($qhandle);
}
function Db_insertid ($qhandle) {
Return @mysql_insert_id ($qhandle);
}
function Db_error () {
return "\ n
". @mysql_error ()."
\ n ";
}
?>
The above describes the database abstraction Layer function library for MySQL, including the database function library aspects, I hope that the PHP tutorial interested in a friend helpful.