Php, XML, XSLT, and Mysql are used in combination. for installation, read the application and installation of php, XML, XSLT, and Mysql, users often ask some posts about the combination of php, XML, and database, and some beginners often write php code and HTML code together, then, when an error occurs, the system cannot find the error. in a hurry, click "> <LINKhref =" ht ".
I often see some posts about the combination of php, XML, and database, and some beginners.
The php code and HTML code are mixed together, and the error cannot be found in the case of an error. the error is so anxious that I will give it a big one.
Let's talk about how to use XML technology to separate HTML code from PHP programs. of course, there are many separation technologies, such as PEAR
IT template.
In general, I personally think that using XML technology is the most convenient. if you don't talk much about it, let's get down to the truth,
Let's talk about the installation in win2000.
Some dll libraries are required to use xml and xslt in php,
Extension = php_domxml.dll // Function library for operating XML
Extension = php_iconv.dll // for transcoding, such as converting GB2312 to UTF-8
Extension = php_xslt.dll // Function library of XSLT
When using the above three libraries, you need to add the dlls directory under the php installation directory to the path, otherwise it will not be found
The
In the following course, we will use the PEAR class library in php, mainly using the DB class library and Sql2XML class library.
Download the latest pear.php.net version.
After downloading the above two class libraries, you 'd better set them in php. ini.
Include_path = ".; d: phppear"
D: phppear is the installation path of my pear.
After the configuration is complete, restart the machine. otherwise, Apache cannot be started properly because the path cannot be found.
So far, we have to use the XML and XSLT settings in PHP. is it very simple :)
Linux users can
Http://www.gingerall.com/download the source code for release t.
Http://www.gnu.org/software/libiconv/download source code for iconv
The combination of php, XML, XSLT, and Mysql
Next I will talk about a simple process of extracting data from the database, generating XML documents, and converting to HTML using XSLT,
This process only describes the process of using this technology, and does not involve paging and other technologies.
In this example, I use the following database tables and data
Table name: enterprise user information table, English name: yhxx
Table structure:
#
# Data table structure 'hxx'
#
Create table yhxx (
Nsnm varchar (15) not null default '',
Qymc varchar (200) not null default '',
Qydh varchar (50) not null default '',
Primary key (nsnm)
) TYPE = MyISAM COMMENT = 'User info table ';
#
# Data table content 'hxx'
#
Insert into yhxx VALUES ('20170101', 'qiao Jia Food Development Co., Ltd. ', '2017-123 ');
Insert into yhxx VALUES ('20170101', 'Shanghai Jialing Trading Co., Ltd. ', '20170101 ');
Insert into yhxx VALUES ('20170101', 'Emerald art company', '20160301 ');
Next, I will write the data extraction program and the data display page.
To make everyone understand, I use the simplest method to write programs.
Program File name: browesData. php
Page File name: browesData.html
Download programs and page files. this program has passed testing in win2000 and mysql.
For the code, see the next page.
If you are interested in this technology, I will share with you some more in-depth application of php in combination with xml, xslt, and databases.