A database abstraction layer function library for mysql //
// 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 has DES 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 ";
}
?>