PHP and MySQL Web Development - P53

PHP and MySQL Web Development - P53: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 232 Chapter 10 Accessing Your MySQL Database from the Web with PHP You can then access each of the attributes via row- title row- author and so on. Each of these approaches fetches a row at a time. The other approach is to access a field at a time using mysql_result . For this you must specify the row number from zero to the number of rows ms 1 as well as the field name. For example row mysql_result result i title You can specify the field name as a string either in the form title or or as a number as in mysql_fetch_row .You shouldn t mix use of mysql_result with any of the other fetching functions. The row-oriented fetch functions are far more efficient than mysql_result so in general you should use one of those. Disconnecting from the Database You can use mysql_close database_connection to close a nonpersistent database connection. This isn t strictly necessary because they will be closed when a script finishes execution anyway. Putting New Information in the Database Inserting new items into the database is remarkably similar to getting items out of the follow the same basic steps make a connection send a query and check the results. In this case the query you send will be an INSERT rather than a SELECT. Although this is all very similar it can sometimes be useful to look at an example. In Figure you can see a basic HTML form for putting new books into the database. The HTML for this page is shown in Listing . Listing HTML for the Book Entry Page html head title Book-O-Rama - New Book Entry title head body h1 Book-O-Rama - New Book Entry h1 form action method post table border 0 tr td ISBN td Putting New Information in the Database 233 Listing Continued td input type text name isbn maxlength 13 size 13 br td tr tr td Author td td input type text name author maxlength 30 size 30 br td tr tr td Title td td input type text name title maxlength 60 size 30 br td tr tr td Price td td input type .

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