Ý kiến phản hồi sẽ được gửi đến darkedeneurope.com: Bằng cách nhấn nút gửi, ý kiến phản hồi của bạn sẽ được sử dụng để cải thiện các sản phẩm và dịch vụ của darkedeneurope.com. Chính sách về quyền riêng tư.
Đang xem: Oop in php tutorial
Trong bài viết này
Download PHP Driver
The demo program is designed so that a transient error during an attempt to connect leads to a retry. (Transient error codes start with the prefix “08” as listed in this appendix.) But a transient error during query command causes the program to discard the connection and create a new connection, before retrying the query command. We don”t recommend or discourage this design choice. The demo program illustrates some of the design flexibility that is available to you.
Xem thêm: Review Sữa Rửa Mặt Hazeline Ngọc Trai Có Tốt Không, Review Sữa Rửa Mặt Hazeline
The length of this code sample is due mostly to the catch exception logic.
The sqlsrv_query() function can be used to retrieve a result set from a query against SQL Database. This function essentially accepts any query and connection object and returns a result set, which can be iterated over with the use of sqlsrv_fetch_array().
“AdventureWorks”, “Uid”=>”yourusername”, “PWD”=>”yourpassword”, “LoginTimeout” => $connectionTimeoutSeconds); $conn = null; $arrayOfTransientErrors = array(“08001”, “08002”, “08003”, “08004”, “08007”, “08S01”); for ($cc = 1; $cc “; $tsql = “SELECT Name FROM Production.ProductCategory”; $stmt = sqlsrv_query($conn, $tsql); if ($stmt === false) { echo “Error in query execution”; echo “”; die(print_r(sqlsrv_errors(), true)); } while($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)) { echo $row<"Name"> . “” ; } sqlsrv_free_stmt($stmt); sqlsrv_close( $conn); break; } else { //