TAILIEUCHUNG - PHP and MySQL by Example- P8

Tham khảo tài liệu 'php and mysql by example- p8', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | 3 function get_info record array 4 result_set mysql_query SELECT FROM Shippers 5 while row mysql_fetch_assoc result_set array_push record row 6 return record br br b php 7 company_records get_info 8 foreach company_records as key value 9 foreach value as field_key val print field_key val br print hr b font body html Explanation 1 The PHP mysql_connect function opens up a connection to the MYSQL server and returns a link to the server so that now we can access a database. 2 This is where the database is selected. A popular database called northwind is opened and a resource handle is returned to give access to it. A resource type holds a special handler to the database connection created when the database connection was made. 3 The function get_info is defined. It will retrieve all the records from the Shippers table and return them to the caller. 4 The mysql_query function sends a query to the currently active northwind database and returns a reference to the data it selected that is all of the records in Shippers. 5 The mysql_fetch_assoc function returns an associative array that corresponds to the fetched row and moves the internal data pointer ahead to the next row. 6 A set of records from the Shippers table are returned to the caller as an array of associative arrays. Please purchase PDF Split-Merge on to remove this watermark. 7 The get_info function is called. An array of records associative arrays is returned and assigned to company_list. 8 The foreach loop is used to iterate through the keys and values of the three arrays each of which contains an associative array. 9 This inner foreach loop retrieves the keys and values from each of the associative arrays returned from the function which is each record in the Shippers table. The output is shown in Figure . Figure . A function that returns an associative array. Output from Example . . Using Callback Functions A callback function is one that is not directly invoked in the .

TỪ KHÓA LIÊN QUAN
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.