Home  >  Article  >  Backend Development  >  Database abstraction layer function library for mysql

Database abstraction layer function library for mysql

WBOY
WBOYOriginal
2016-08-08 09:33:551020browse

//
// 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 "nn

".@mysql_error()."

nn";
}

?>

  
  

以上就介绍了用于mysql的数据库抽象层函数库,包括了数据库函数库方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn