search

ADODB的使用

May 25, 2016 pm 05:11 PM
php

[PHP]代码   

Adodb的使用文档
1.       在adodb官网http://www.php.cn/下载adodb,在php脚本中引入核心文件adodb.inc.php例如:include(‘adodb/adodb.inc.php’)

2.       连接数据库类conn.php
<?php
include(&#39;adodb/adodb.inc.php&#39;);//包含ADODB的类库
$con=ADONewConnection(&#39;mysql&#39;);//MySql数据库
$db_host="localhost";//主机
$db_user="root";//用户名
$db_pass="";//密码
$db_name="forum";//数据库名
@$testConn=$conn->Connect($db_host,$db_user,$db_pass,$db_name);//连接数据库
if(!$testConn){
 echo "数据库连接失败!";
}
$ADODB_CACHE_DIR=&#39;tmp&#39;;
$conn->Execute("set names gb2312");//软件字符编码格式
?>



3.在其他页面调用该连接数据库类

require("configs/conn.php");//引入连接数据库类

$sql="select id,title,posttime,user from topic order by id desc";

$result=$conn->Execute($sql);//执行SQL语句

$articleAll=$result->GetArray();//获得数据表中所有的帖子

4.其他函数参考adodb文档

                   

                   

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!