The fetchAll () method is to obtain all rows in the result set and return a binary array containing all rows in the result set!
Detailed description of fetchAll () method for getting result sets in PDO
The fetchAll () method is to obtain all rows
Fetchall () method of obtaining result set in PDO
The Fetchall () method is to get all the rows in the result set, returning a binary array containing all the rows in the result set!
So in the previous article "fetching the result set in PDO" in
database Query OperationsPython queries MySQL uses the Fetchone () method to get a single piece of data, using the Fetchall () method to get multiple data. Fetchone (): This method gets the next query result set. The result set is an object
The difference between fetchAll () and mysql_fetch_array () is described in detail. The same query statement: fetchAll (): Copy the code as follows: array (1) {[0] array (6) {[id] string (2) 15 [0] string (2) 15 [lot_sellid] string (20) 0000000000000
Recently, when working with the MySQL database in Python, the following two functions were encountered, labeled:Fetchone ():Returns a single tuple, which is a record (row), and returns none if no result is foundFetchall ():Returns multiple tuples,
This article provides a detailed analysis of the differences between fetchAll () and mysql_fetch_array (). For more information, see the following query statement:
FetchAll ():
The code is as follows:
Array (1 ){[0] => array (6 ){["Id"] =>
A simple example of how Python operates the database is really very simple compared to Java JDBC, which eliminates a lot of complicated repetitive work and only cares about data acquisition and manipulation.
preparatory workThe appropriate
PDO, PDOStatement, PDOException, pdopdostatement
More detailed information about PDO recently
Source: http://blog.csdn.net/hsst027/article/details/23682003
PDO contains three predefined classes: PDO, PDOStatement, and PDOException.
PDO requires the
ZendFramework Database Summary [original]. Zend_Db database knowledge example: Model File: $ this-fetchAll (is_jian1, idDESC,)-toArray (); according to is_jian1, sort by id in reverse order. obtain the first two records. if the first parameter is
MySQL connection in PHP PDO use detailed, PDO WAN apply Xuan "в
PDO Common methods:
Pdo::query () is primarily used for operations (pdostatement) that have logged results returned, especially for select operations.
Pdo::exec () is primarily for
PDO Common methods: Pdo::query () is primarily used for operations (pdostatement) that have logged results returned, especially for select operations. Pdo::exec () is primarily for operations returned without a result set. such as Insert,update and
zend_db Database Knowledge
Example:
Model file:
$this->fetchall ("Is_jian=1", "id DESC", 0,2)->toarray ();//According to Is_jian=1, the first 2 records are sorted in reverse order The ASC is ordered directly by the reverse ID.
Routing files:
$video =
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.