A database abstraction layer function library for mysql

Source: Internet
Author: User
A database abstraction layer function library for mysql. read a database abstraction layer function library for mysql ,? Php // SourceForge: BreakingDowntheBarrierstoOpenSourceDevelopment // Copyright1999-2000 (c) TheSourceFor //
// 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 ";
}

?>



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.