PHP, or hypertext preprocessor, is a program that is embedded in a Web page and executed by the server side. It has cross-platform, object-oriented and integrated with the database perfect features, for the vast number of web programmers favor.
MySQL uses the structure of the associated database, which is a simplified and fast database management program. It provides management features that are used by many people and supports standard SQL syntax. It also has cross-platform capabilities as well as PHP.
Using Php4+mysql+win98 (PWS) to build an information platform is achievable. In this paper, I take a simple student information management system as an example, to talk about their own personal experience, to treat the reading
Actors
The first step is to install the server
To use the WIN98 platform's computer as a server, you must install PWS (Personal Web server). The reader can be found in the ADD-ONSPWS directory in the Win98 CD and run Setup.exe directly.
When the installation is complete, create a new directory (d:php) on your hard disk to store the PHP files specifically. Run PWS, enter the interface, click Advanced, go to the Advanced Options interface, click the Add button, create a new virtual directory PHP, select d:php as its directory, and check the "execute" option.
Step two, install PHP4
Place the PHP4 file in the C:PHP4, copy Php4ts.dll,msvcrt.dll to C:windowssystem, rename Php.ini-dist to PHP.ini, and copy to C:windows.
Also need to configure php.ini, as follows:
Extension_dir=c:/php/extensions
Asp_tags = on; Allow ASP-style tags, that is, <%%> browscap = C:windowssysteminetsrvrowscap.ini (because the server used is PWS)
Readers can also find that there are ";" numbers in front of many lines in the php.ini, which indicates the comment line. Configuring PHP also needs to remove the semicolon before the following lines.
Extension =php_ldap.dll (LDAP function)
Extension =php_zlib.dll (zlib function)
Extension =php_calendar.dll (Calendar conversion function)
Extension =php_exif.dll (EXIF function)
Extension =php_ftp.dll
Extension =php_mssql70.dll
Extension =php_imap.dll
Then enter the C:PHP4 SAPI directory, run Pws-php4isapi.reg, and change the registry. Execute regedit, open Registry Editor, open HKEY_LOCAL_MACHINE | System | CurrentControlSet | Services | W3SVC | Parameters | Script Map, right-click the primary key, select New | String value from the pop-up shortcut menu, and name. PHP (either the extension of the PHP Web page, or. php4,. phtml or others), and set its value to: C:php4sapiphp4isapi.dll. Close the Registry Editor.
Step three, install MySQL
The Setup program Setup.exe,mysql running MySQL is installed in C:mysql. The directory under the MY-EXAMPLE.CNF renamed to MY.CNF, copied to the C-packing directory.
Run the Mysqld.exe (or Mysqld-shareware.exe) in the C:mysqlin directory, and MySQL starts. If you want users to be able to browse the query database later, you must run the file to start the database.
We must also set up the MySQL database administrator account (root) and password (123456): In the DOS interface into the C:mysqlin, enter the command line mysqladmin-u root password 123456 can be.
In this way, Php4+mysql+win98 (PWS) is installed and set to complete.
Step fourth, add data
Start the MySQL database first, then in the DOS window, execute the mysql-u root-p command line, enter the password, and start editing the database. The specific steps are as follows:
1. Create the database data, that is, the C:mysqldata directory.
MySQL >create database data;
MySQL >use data
2. Create table student in database data
Mysql>create Table Student (
->stu_no Char (6) Not Null,
->name Char (8),
->birthday Date,
->math_score Tinyint
->primary Key (Stu_no)
->);
3. Create a new text document in the C:mysqldata directory Student.txt, enter records in the order of each field, with tab spacing between each field.
4. Import the records from Student.txt into the table student. That represents the tab character, which represents a carriage return.
Mysql>load Data Infile ' student.txt ' into table student
->fields terminated by ""
->lines terminated by ';
Fifth step, write PHP program
Enter the following code in Notepad and save it as a test.php in the d:php directory.
?
If (! mysql_connect ("localhost", "root", "123456"))
echo "Failed to connect to database";
Elseif (! mysql_select_db ("Data"))
echo "Open database Failed";
sql = "SELECT * from student";
Records = mysql_query (SQL);
?>
&nbs
P <body>
<center>
<table border=1>
<tr bgcolor=blue>
<td> number </td><td> name </td><td> birthday </td><td> number discipline score </td>
</tr>
?
while (List (stu_no, name, birthday, Math_score) =mysql_fetch_row (Records))
{
echo "<td>". Stu_no. " </td><td> "..." </td><td> ". Birthday. " </td>
<td> ". Math_score. " </td></tr> ";
}
?>
</table>
</body>
Enter http://127.0.0.1/php/test.php in the browser to see the effect shown in Figure 5. Of course this must be based on all the settings are correct on the basis, remember to start PWS and MySQL Oh!
As an educator, it is particularly important to manage the students ' information. This article just play a role, we can enrich the system, so that it has the query, update, delete information and other functions. In this way, the management of voluminous student information will no longer be difficult!
For other industry's PHP enthusiasts, the Win98 platform to enjoy the fun of PHP, but also a great pleasure. I wish you all to make more and better works.