Database abstraction Layer function library for MySQL

Source: Internet
Author: User
Tags php tutorial
//
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.

  • Related Article

    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.