PHP 5/MySQL Programming- P42

PHP 5/MySQL Programming- P42:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 183 FIGURE The user is an administrator preparing to edit a quiz. Chapter 6 Working th Files figure The user has chosen to edit the Monty Python quiz. Taking a Quiz Users with knowledge of the appropriate password can take any of the quizzes known to the system. If a user chooses to take the Monty Python quiz the screen shown in Figure appears. 184 PHP 5 MySQL Programming for the Absolute Beginner figure The user is taking the Monty Python quiz. If you want to become a serious programmer you should probably rent this movie. It s part of the culture. Seeing the Results When the user takes a quiz the user s responses are sent to a program that grades the quiz and provides immediate feedback as shown in Figure . figure The grading program provides immediate feedback and stores the information in a file so the administrator can see it later. 185 Viewing the Quiz Log The system keeps a log file for each quiz so the administrator can see each person s score. Figure shows how people have done on the Monty Python quiz. figure The log retrieval program presents an activity log for each quiz. Chapter 6 Working ith Files Although the resulting log looks very simplistic it is generated in a format that can easily be imported into most gradebook programs and spreadsheets. This is very handy if you use the quiz in a classroom setting. Saving a File to the File System Your PHP programs can access the server s file system to store and retrieve information. Your programs can create new files add data to files and read information from the files. You start by writing a program that creates a file and adds data to it. Introducing the Program The program shown in the following code opens a file on the server and writes one of Shakespeare s sonnets to that file on the server. Normally I show you a screen shot of every program but that isn t useful since this particular program doesn t display anything on the screen. The next

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
187    27    1    30-11-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.