TAILIEUCHUNG - PHP & MySQL for Dummies- P6

Tham khảo tài liệu 'php & mysql for dummies- p6', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 8 Data In Data Out 231 The program in Listing 8-4 proceeds as follows 1. It calls the function getPetsOfType. It passes horse in a variable type containing the type of pet. It also sets up petInfo to receive the data returned by the function. 2. The function connects to the database and selects the database PetCatalog. 3. The function sends a query to get all the rows with petType in the petType column. petType is passed to the function in the function call. The data is stored in a table in a temporary location. The variable result identifies the location of the temporary table. 4. It sets up a counter. j is a counter that is incremented in each loop. It starts at 1 before the loop. 5. It starts a while loop. The function attempts to get a row from the temporary data table and is successful. If there were no rows to get in the temporary location the while loop would end. 6. It starts a foreach loop. The loop walks through the row processing each field. 7. It stores values in a multidimensional array. array_multi is a multidimensional array. Its first key is a number which is set by the counter. Because this is the first time through the while loop the counter j is now equal to 1. All the fields in the row are stored in array_multi with the column name as the key. I explain multidimensional arrays in detail in Chapter 7. 8. It increments the counter. j is incremented by 1. 9. It reaches the end of the while loop. 10. It returns to the top of the while loop. 11. It repeats Steps 5-10 for every row in the results. 12. It returns array_multi to the main program. array_multi contains all the data for all the selected rows. 13. petInfo receives data from the function. All the data is passed. Figure 8-3 shows the structure of petInfo after the function has finished executing. Please purchase PDF Split-Merge on to remove this watermark. 232 Part lll PHP_ petinfo 1 petName Unicorn .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.