PHP 5/MySQL Programming- P85

PHP 5/MySQL Programming- P85: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 | 398 PHP 5 MySQL Programming for the Absolute Beginner hr form action method post table border 1 tr td colspan 2 center h2 Edit Delete table data h2 center td tr tr td Password td td input type password name pwd value absolute br td tr tr td colspan 2 center select name tableName size 5 option value agent agents option option value specialty specialties option option value operation operations option option value agent_specialty agent_specialty option option value storedQuery storedQuery option select center td tr tr td colspan 2 center input type submit value edit table center td tr table 399 form body html -r -i I I I .1 I r- I I .1 -tR To make debugging easier I preloaded the password field with the appropriate password. In a production environment you should of course leave the password - field blank so the user cannot get into the system without the password. Building the Program When the user chooses a query program control is sent to the program. This program does surprisingly little on its own html head title View Query title head body center h2 Query Results h2 center include dbConn connectToSpy take out escape characters. theQuery str_replace . theQuery print qToTable theQuery print mainButton body html Chapter 12 Building a Three-Tiered Data Application 400 PHP 5 MySQL Programming for the Absolute Beginner Once connects to the library it uses functions in the library to connect to the database and print desired results. The qToTable function does most of the actual work taking whatever query is passed to it and generating a table with add delete and edit buttons. Why store queries in the database You might wonder why I chose to store queries in the database. After all I could have let the user type in a query directly or provided some form that allows the user to search for certain values. Either of these approaches has advantages but they also pose some risks. It s very dangerous to .

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
272    23    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.