PHP with XML, XSLT, MySQL, the combination of application, installation article

Source: Internet
Author: User
Tags insert mysql pear php and php code table name xslt
Mysql|xml Original:
Author: Xiaocon
Email: xiaocon@21cn.com
Reprint please indicate the source


PHP with XML, XSLT, MySQL, the combination of application, installation article
Often see a user to ask some about PHP and XML, database combination of the use of posts, but also often see some beginners
Mix the PHP code with the HTML code, and then when the error can not find the error, the rush, I will give a big
Home about how to use XML technology to separate the HTML code from the PHP program, of course, there are many kinds of separation technology, such as Pear
's IT templates.
On the whole, personally think that using XML technology is the most convenient, not much nonsense, we have to talk about,
Tell me about the installation under the Win2000.

Use XML and XSLT in PHP to use some DLL libraries,
Extension=php_domxml.dll//Operation XML Library of functions
Extension=php_iconv.dll//transcoding, such as converting GB2312 to UTF-8
function Library of Extension=php_xslt.dll//XSLT

When using the three libraries above, you should add the DLLs directory under the PHP installation directory to the path, or you will not be able to find
Of these class libraries

In the following course, we will use the Pear Class Library in PHP, mainly with the DB Class Library, Sql2xml class library, you can
Pear.php.net Download the latest version
After downloading the above two class libraries, we'd better set up in php.ini
include_path = ".; D:\php\pear "

D:\php\pear is the installation path of my pear

After setting up, restart the machine, or because the path can not be found to cause the Apache boot is not normal to use


This is done by using the XML and XSLT settings in PHP, which is simple:
Users who use Linux can go to the
http://www.gingerall.com/Download the source code for XSLT
http://www.gnu.org/software/libiconv/Download the source code for ICONV

Two PHP with XML, XSLT, MySQL, the combination of application, the first chapter
What I'm going to talk about here is a simple process of extracting data from a database, generating an XML document, and translating it into HTML using XSLT,
This process only speaks of the process of using this technology and does not involve paging and other technologies

This example I use the following database tables and data
Table Name: Enterprise User Information table, English name: yhxx
Table structure:
#
# The structure of the datasheet ' yhxx '
#

CREATE TABLE Yhxx (
NSRNM varchar not NULL default ',
QYMC varchar not NULL default ',
QYDH varchar not NULL default ',
PRIMARY KEY (NSRNM)
) Type=myisam comment= ' User Information table ';

#
# datasheet content ' Yhxx '
#

INSERT into Yhxx VALUES (' 310109040111985 ', ' Joe's Diet Development Co., Ltd. ', ' 8621-63346626 ');
INSERT into Yhxx VALUES (' 310104040221736 ', ' Shanghai Jialing Trade Co., ltd ', ' 74292546 ');
INSERT into Yhxx VALUES (' 310108040331576 ', ' Jade Art Company ', ' 54861465 ');


Next I start to write the data extraction program and the page that displays the data
In order for everyone to understand, I use the simplest way to write a program

program file name: browesdata.php
Paging File name: browesdata.html
Procedures and page files to provide downloads, this program has been in Win2000, MySQL passed the test
Code See next page


If you're interested in this technology, I'll tell you more about PHP and XML, XSLT, and databases. A further application









Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.