More and more mobile phones support the WAP function. Therefore, you should also consider creating your own WML website. This article will introduce how to create a site on the PHP/WML page and use the MySQL database to dynamically update the site content, the specific example is the teaching time and test schedule of a professor in a college. Not complicated at all.
Before you start, you should prepare the following items:
1. You have installed PHP and MySQL correctly, and have experience programming with both.
2. You have knowledge about SQL.
3. You are running Apache and can write. haccess files; or you are running IIS and you can add mappings (or you can ask the system administrator to help you );
4. You have knowledge about WML;
Well, the first step is to let your server know How to Use PHP to process WML files. The following describes how to do this.
Set Server
If you are using Apache, you must find a. htaccess file in your directory. Then, add the following lines:
Addtype applications/x-httpd-php3. WML
If you cannot find the file, you can add one and add the above lines to your directory.
If you are using IIS, you must make some changes, similar to when installing PHP: Check the ing between. php and. php3 extensions, and add the same ing processing for. WML.
Usually you will find that PHP is mapped:
C: \ PHP \ php4isapi. dll
Or
C: \ PHP \ php.exe
Preparations
If you are using a Microsoft operating system, you can install the Nokia development kit. It can check your syntax and allow you to preview the WML page through a phone-like interface. This toolkit also contains reference documents on WML and WML scripts. If your phone does not support WAP, or you cannot use a WAP Gateway, this can be a great help.
To download this tool, you must first register (http://www.forum.nokia.com/main/0,6668,1_1_4,00.html) on this website as a WAP developer ), remember that you need support for Java2 runtime enviroment (support for Java2 runtime environment ). You can use any text editor to write pages.
Write any PHP/WMLCodeYou need to create a MySQL table.
The database consists of four tables.
1. The professors table contains professor-related data;
2. The subjucts table contains the topic-related data;
3. the exams table includes test data;
4. The teach table contains the relationship information between the professor and the subjects they have granted.
When connecting to MySQL, you can use the following code to create a table
Create Table professors (
Id int (11) default '0' not null auto_increment,
Surname varchar (24) not null,
Name varchar (24) not null,
Email varchar (48) default 'not avaliable ',
Cod_course varchar (16) default 'not avaliable ',
Consulting_hour varchar (128) default 'not avaliable ',
Consulting_place varchar (128) default 'not avaliable ',
Primary Key (ID)
);
These statements establish the table structure of professors. Each professor is assigned a unique identification number and is the primary key of the table. Other fields, surname, name, and email, are used to indicate the last name, name, and e-mail address of each professor. Cod_course uniquely identifies the value of each subject. Finally, consulting_hour and consulting_place indicate the teaching time and place.
Create Table subjects (
Subject varchar (96) not null,
Cod_subject varchar (24) not null,
Cod_number varchar (12) not null,
Primary Key (cod_subject)
);
Subject is the name of a subject. cod_subject is the name used by the school to represent each subject. Its value is unique and is the primary key of the table. Cod_number is a numeric field. different courses of the same subject belong to a group. This number is the identification number of the group.
Create Table exams (
Cod_subject varchar (24) not null,
Id int (11) not null,
Date default '2014-00-00 ',
Time default '00: 00: 00 ',
Room varchar (64 ),
Test varchar (16) default 'oral'
);
Cod_subject refers to the name used by the school to represent each subject and is unique. ID is the unique identification number of the professor. date, time, and room are used to record the date, time, and location of the test, test indicates the type of the test (including written and verbal)
Create Table teach (
Cod_subject varchar (16) not null,
Id int (11) default '0' not null,
Primary Key (ID, cod_subject)
);
In the teach table, the ID is the identification number of the professor. The meaning of cod_subject is the same as above. The two constitute the primary key of the table.
The next step is to fill in some data in the database, which can be completed by yourself.