MYSQL TUTORIAL IV
- This is a tutorial for building dynamic web pages to implement
the function of user registration. In this tutorial, you can
save the registration information to and query from MySQL
database by using html and programming languages.It covers the
basics of CGI programming and accessing MySQL with C, Perl, PHP,
Java or Python. After this tutorial, you should be able to
create simple dynamic web pages for users to submit information
through html form and to interact with MySQL databases.
- Basic knowledge about html, especially html form.
- Basic knowledge about database and MySQL.
- Basic knowledge about the programming language your want to
- Basic knowledge about how to connect to a Linux Server using
- Log into the EECS Linux Server cycle1.eecs.ku.edu
a) You can log into cycle1 from a Linux machine by using
"ssh" command to securely shell to cycle1. For example:
[xli72@1005-11 ~]$ ssh -l < YourEECS
Last login: Tue Aug 26 17:20:54 2013 from 1005-11.eecs.ku.edu
b)You can log into cycle1 from a windows machine by using
SSH client for Windows. If you are using a EECS widows machine,
you can use PuTTY, which has been already installed on the
If you don't have a SSH client, you need download and
install one(It is required to log into EECS website by using your
EECS account before you can download)
- Change your current directory to public_html under your home
directory by executing command: cd public_html. Then
begin your tasks.
- Create a html file with two links: one for user registration
and the other for user information querying.
- For user registration, create a html form so that users can
input their registration information. The registration
information should include: name, phone number and
address. All these fields should be filled in by
- Write a CGI program to get the registration information
submitted by a user, store the information in the related
database table, and provide feedback to the user. Your program
should be able to handle two cases of registration:
- If the user has filled in all the fields in the
registration page, save the registration information to your
MySQL database and display a message for successful
- If the user did not fill in all the fields, your program
should display a warning message to reminder the user to
input all the required informaiton.
- For user information querying, create a html form so that
staff members can search the information of registered users by
phone number. A staff member inputs a phone number in the
form. Develop a CGI program to retrieve the information of those
registered users whose phone number match with the query and
display the search results to the staff member. Your program
should be able to handle two cases of search:
- If there are registered users in your database whose
phone number matches with the query, display ALL he
registration information of these registered users. Display
one record of the information on one line.
- If there is no registered user in your database whose
phone number matches with the query, display a message
stating no information is found.
Note:You should create web pages in the directory: public_html.
All your CGI programms should be in the directory public_html/cgi-bin.
For example, if your EECS user name is jhuan, then you should
create html files in the directory /home/jhuan/public_html and put
your CGI programs in the directory
- You should submit a Lab report including the following parts:
- A short description of how you
designed your html files and your CGI program
- Use screen shots of your webpages to
show how you test your program
- the url of your web pages.
- The source code of your program,
including source code for your html pages.
ALL YOUR MATERIALS SHOULD BE SUBMITTED AS A PART OF YOUR
HOMEWORK, WHICH MUST BE A SINGLE FILE.
- If you have any further questions
regarding your MySQL account or MySQL, please feel free to
contact the instructor.