tailieunhanh - Hướng dẫn sử dụng MySQL part 20

PHP cung cấp một loạt các chức năng hữu ích khi tạo cơ sở dữ liệu-driven ứng dụng. Vì vậy, nhiều, trên thực tế, rằng nó sẽ là khó sử dụng để liệt kê tất cả chúng trong một cuốn sách về MySQL. Vì vậy chương này tham chiếu tập trung vào các chức năng mà PHP cung cấp giao diện trực tiếp với MySQL. Điều này bao gồm các lớp trừu tượng PHP cơ sở dữ liệu mới hứa hẹn một ngày nào đó thống nhất cơ sở dữ liệu PHP API khác nhau thành một bộ chức năng | DRAFT 8 24 01 23 PHP Reference PHP provides a wide range of functions that are useful when creating database-driven applications. So many in fact that it would be unwieldy to list all of them in a book about MySQL. Therefore this reference chapter concentrates on the functions that PHP provides to interface directly with MySQL. This includes the new PHP database abstraction layer which promises to someday unify the various PHP database APIs into a single set of functions. mysql_affected_rows Returns the number of rows affected by the last non-SELECT statement num_rows mysql_affected_rows mysql mysql_affected_rows returns the number of rows altered in any way by the last statement. Since this only reports on rows that have been changed in some way it has no meaning when used after a SELECT statement. Also there are a couple of cases where MySQL performs optimizations that affect the result of this function UPDATE - It is import to note as mentioned above this function returns the number of rows that are changed in some way by the query. This means that an UPDATE query that matches a row but does not change its value is not counted. For example the query UPDATE mytable SET column fnord will return 0 if every row in the table already has fnord for the value of column . DELETE - MySQL performs an optimization with deleting the entire contents of a table that makes it impossible to tell the number of rows that were in that table. Therefore if you delete all of a table using DELETE from tablename with no WHERE clause this function will return 0. A specific connection can be specified by passing the connection identifier variable as a parameter to this function. Otherwise the most recently opened connection is used. Copyright 2001 O Reilly Associates Inc. 1 DRAFT 8 24 01 This function should be called immediately after the query you are interested in. This holds true even when using tables that use transactions this function should be called after the query not the .

TỪ KHÓA LIÊN QUAN