PHP 5/MySQL Programming- P89

PHP 5/MySQL Programming- P89: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 | 418 form PHP 5 MySQL Programming for the Absolute Beginner HERE return output end smartRToEdit What makes this function smart is its ability to examine each field in the record and make a guess about what sort of field it is. Figure shows the result of the smartRToEdit program so you can compare it to the not-so-clever function in Figure . figure The smarter function prevents the user from editing the primary key and provides a drop-down list for all foreign key references. Determining the Field Type As far as this function is concerned three field types in a record need to be handled differently. Primary key. If a field is the primary key its value needs to be passed on to the next program but the user should not be able to edit it. Foreign key. If a field is a foreign key reference to another table the user should only be able to indirectly edit the value. The best approach is to have a drop-down list box that shows values the user will recognize. Each of these values corresponds to a key in that secondary record. For example in Figure there is a list box for the operationlD field. The operationlD field is a foreign key reference in the agent table. The ordinary rToEdit 419 function allows the user to type any index number into the textbox without any real indication what data correlates to that index. This version builds a drop-down list showing operation names. The key value associated with those names is stored in the value attribute of each option. Details to follow in the fieldToList function. The user doesn t have to know anything about foreign key references or relational structures he simply chooses an operation from a list. That list is dynamically generated each time the user chooses to add a record so it always reflects all the operations in the agency. Neither a primary nor secondary key. In this case I print a simple textbox so the user can input the value of the field. In all cases the output will reflect the current value of

Không thể tạo bản xem trước, hãy bấm tải xuống
Đã 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.