一个用于mysql的数据库抽象层函数库_PHP教程

WBOY
發布: 2016-07-21 16:04:35
原創
902 人瀏覽過

//
// 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\n

".@mysql_error()."

\n\n";
}

?>

  

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/315898.htmlTechArticle?php // // 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...
相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!