=========================================
Php100:80:adodb PHP Database Universal engine Class
ADODB PHP Database Introduction and Features
ADODB is a compatible variety of database application interfaces (APIs) that can be used in a variety of databases. Mysql,postgresql,interbase,firebird,informix,oracle,ms SQL 7,FOXPRO,ACCESS,ADO,SYBASE,FRONTBASE,DB2
ADODB links and uses of various databases in PHP specification
ADODB helps us to provide development efficiency in PHP and quickly convert various databases
ADODB use relatively simple
ADODB writing requirements more rigorous, pay attention to the case
ADODB built-in functions are more abundant
How to configure and use ADODB PHP
Download ADODB for PHP Class Library compression package
Unzip to any folder under the Site Directory
Introducing the ADODB configuration file
Configure the required database connections
Using built-in methods to manipulate linked databases
To connect to MySQL:
Include_once ("adodb5/adodb.inc.php"); Contains the ADODB class library file
$db = newadoconnection (' mysql ');
$db->connect (' localhost ', ' root ', ' 1981427 ', ' test ') or Die ("df"); Connect to MySQL Database
?>
Connect to access:
Include_once ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' access '); Connect to an Access database
$conn->connect ("test.mb") or Die ("Cuowu");
?>
Connection DB2:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn =newadoconnection (' DB2 '); Connecting the DB2 Database
$conn->connect ("DRIVER={IBM DB2 ODBC driver};d atabase=mydb;hostname=localhost;port=50000;
Protocol=tcpip;uid=root; Pwd=pass ");
?>
Connect PostgreSQL:
Include ("adodb/adodb.inc.php"); Contains the ADODB class library file
$conn = newadoconnection (' Postgres ');
$conn->connect (' localhost ', ' root ', ' pass ', ' mydb '); Connect to PostgreSQL Database
?>
*******
ADODB PHP for fast query function
Include_once ("adodb5/adodb.inc.php");
$db = &newadoconnection (' mysql ');
$db->connect ("localhost", "root", "" "," db ") or Die (" error ");
$db->execute ("Set names ' GBK '");
$q = $db->execute ("SELECT * from Up_admin_user");
while ($row = $q->fetchrow ()) {
Print_r ($row);
}
*************
ADODB PHP for smart Insert function
Include_once ("adodb5/adodb.inc.php");
$db = &newadoconnection (' mysql ');
$db->connect ("localhost", "root", "" "," db ") or Die (" error ");
$db->execute ("Set names ' GBK '");
$arr =array (' m_id ' = ' 2 ', ' password ' = ' 333333 ', ' 33333 ' = ' 4444444 ');
$db->autoexecute ("Up_admin_user", $arr, "INSERT");
************
Instance:
Inquire:
Include_once ("adodb5/adodb.inc.php"); Contains the ADODB class library file
$db = newadoconnection (' mysql ');
$db->connect (' localhost ', ' root ', ' ', ' think_zw ') or Die ("error"); Connect to MySQL Database
$db->execute ("Set names ' GBK '");
$query = $db->execute ("SELECT * from THINK_ZW");
while ($row = $query->fetchrow ()) {
Print_r ($row);
}
?>
Insert: It automatically filters out unused arrays when plugged in. Exclude arrays that are not used.
Fields can be inserted without corresponding inserts.
Include_once ("adodb5/adodb.inc.php"); Contains the ADODB class library file
$db = newadoconnection (' mysql ');
$db->connect (' localhost ', ' root ', ' ', ' think_zw ') or Die ("error"); Connect to MySQL Database
$db->execute ("Set names ' GBK '");
$arr =array ("id" = "",
"Name" = "Small Army",
"Details" and "small army love to see beautiful women";//pay attention not to enclose double quotation marks in single quotation marks
$db->autoexecute ("Think_zw", $arr, "INSERT");
$query = $db->execute ("SELECT * from THINK_ZW");
while ($row = $query->fetchrow ()) {
echo $row [name]. "
";
}
?>
===============================
php100:81:php ADODB Address Mode connection database
1, PHP ADODB address mode connection database
2, PHP ADODB object way to get the database content
3, PHP ADODB HTML code way to display content
4, PHP ADODB to achieve the content of automatic paging function
PHP ADODB address mode to connect to the database:
Include_once ("adodb5/adodb.inc.php");
/* $db = Newadoconnection (' mysql://root: @localhost/upload ');
$sql = "select * from ' pic '";
$db->setfetchmode (ADODB_FETCH_ASSOC),//adodb_fetch_num here is a little bit like the Fetch_array and Fetch_row.
Mysql_fetch_array ()
$SR 1 = $db->execute ($sql);
Print_r ($SR 1->fields);
*/
**********************
PHP ADODB Object way to get database content
$db = newadoconnection (' mysql ');
$db->pconnect ("localhost", "root", "" "," upload ");
$sql = "select * from ' pic '";
$rs 2= $db->execute ($sql);
while ($row = $rs 2->fetchnextobject ()) {
Echo $row->name;
}
*/
*******
PHP ADODB HTML code way to display content
/*
Include_once ("adodb5/tohtml.inc.php");
$db = newadoconnection (' mysql ');
$db->connect ("localhost", "root", "" "," upload ");
$sql = "select * from ' pic '";
$rs 2= $db->execute ($sql);
Echo rs2html ($rs 2);
*/
**************
PHP ADODB for content auto-paging functionality
Include_once ("adodb5/adodb-pager.inc.php");
Session_Start ();
$db = newadoconnection (' mysql ');
$db->connect ("localhost", "root", "" "," upload ");
$db->execute ("Set names ' GBK '");
$sql = "select * from ' pic '";
$pager =new Adodb_pager ($db, $sql);
$pager->render (2);
http://www.bkjia.com/PHPjc/781923.html www.bkjia.com true http://www.bkjia.com/PHPjc/781923.html techarticle ========================================= php100:80:adodb PHP database Universal engine Class ADODB PHP database Introduction and Features ADODB is a compatible variety of database application interface ( ...