PHP中通过ADO调用Access数据库
我看了那篇《怎样在PHP中通过ADO调用Asscess数据库和COM程序》文章后,马上作了测试,结果失败了。伤心是不是。
怎么办?我只好去PHP官方网站求助,皇天不负有心人,终于我找到了答案——
具体的解决方法如下:
(1)进入http://php.weblogs.com/adodb,下载相应的ZIP包;同MICROSOFT公司的ADO一样,该东东用PHP实现ADO同各种各样数据库打交道(太好了,所有类型的数据库都能处理)。
(2)解包,里面文件很多,不过有用的只有ohtml.inc.php和adodb.inc.php,把它们复制到相应目录下(或是安装php4的缺省目录下c:php4peer,或是当前运行程序目录下,视include()函数而定);
(3)然后在本鸡(错误字一个,是机)的c:myphp目录下(iis下设置通过http://localhost/jhk来访问),造了一个名为test.mdb的access库,里头再造个experts的表……。为了通过DSN来访问,我把刚才的ACCESS库在DSN中取名test。
(4)运行。看着说明书我造了这么个程序:
dbtest.php,内容如下:
include( ohtml.inc.php); // load code common to ADODB
include(adodb.inc.php); // load code common to ADODB
$conn = &ADONewConnection(access); // create a connection
$conn->PConnect( est);// connect to MySQL, agora db
$sql = select name, group1 from experts;
$rs = $conn->Execute($sql);
rs2html($rs,order=2 cellpadding=3,array(Customer Name,Customer ID));
$rs->Close(); // optional
$conn->Close(); // optional
?>
然后,IE中打入:http://localhost/jhk/dbtest.php
唉!结果出来了。 令人基本满意!!
(5) 接着,我又想:还要设置DSN,烦不烦!绕过DSN应如何解决?因为在asp中,我习惯用conn.open("provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("../nydatabase.mdb"))来处理mdb库,那速度快呀!
?……想了又想,看了又看……。
找找找,……,嘿嘿,终于在testdatabases.inc.php 中找到了答案! 我再把刚才的程序改编:
include( ohtml.inc.php); // load code common to ADODB
include(adodb.inc.php); // load code common to ADODB
$db = &ADONewConnection("ado_access");
print "
Connecting $db->databaseType...
";$access = est.mdb;
$myDSN = PROVIDER=Microsoft.Jet.OLEDB.4.0;.DATA SOURCE=. $access . ;;.USER ID=;PASSWORD=;;
if (@$db->PConnect($myDSN, "", "", "")) {
print "ADO version=".$db->_connectionID->version."
";
$sql = select name, group1 from experts;
$rs = $db->Execute($sql);
rs2html($rs,order=2 cellpadding=3,array(Customer Name,Customer ID));
} else print "ERROR: Access test requires a Access database $access".
.$db->ErrorMsg();
?>
运行。
一切搞定!
本文章相关类文件本站下载地址为: http://www.phpe.net/?n=ShowClass&a=106

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

Oracle is not only a database company, but also a leader in cloud computing and ERP systems. 1. Oracle provides comprehensive solutions from database to cloud services and ERP systems. 2. OracleCloud challenges AWS and Azure, providing IaaS, PaaS and SaaS services. 3. Oracle's ERP systems such as E-BusinessSuite and FusionApplications help enterprises optimize operations.

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

WordPress IP blocking plugin selection is crucial. The following types can be considered: based on .htaccess: efficient, but complex operation; database operation: flexible, but low efficiency; firewall: high security performance, but complex configuration; self-written: highest control, but requires more technical level.

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

Redis is a memory data structure storage system, mainly used as a database, cache and message broker. Its core features include single-threaded model, I/O multiplexing, persistence mechanism, replication and clustering functions. Redis is commonly used in practical applications for caching, session storage, and message queues. It can significantly improve its performance by selecting the right data structure, using pipelines and transactions, and monitoring and tuning.

DMA in C refers to DirectMemoryAccess, a direct memory access technology, allowing hardware devices to directly transmit data to memory without CPU intervention. 1) DMA operation is highly dependent on hardware devices and drivers, and the implementation method varies from system to system. 2) Direct access to memory may bring security risks, and the correctness and security of the code must be ensured. 3) DMA can improve performance, but improper use may lead to degradation of system performance. Through practice and learning, we can master the skills of using DMA and maximize its effectiveness in scenarios such as high-speed data transmission and real-time signal processing.

In processing next-auth generated JWT...
