Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online

pdostatement fetchall function syntax tag tutorial 2013





Alert! Connect with 10,000 Chating Online. Join Now

Php pdostatement fetchall () function

Write your php code

 
<?php ?>

Php Result


Your code below



(no version information, might be only in CVS)

PDOStatement::fetchAll --  Returns an array containing all of the result set rows

Syntax

array PDOStatement::fetchAll ( [int fetch_style] )

Warning

This function is EXPERIMENTAL. The behaviour of this function, the name of this function, and anything else documented about this function may change without notice in a future release of PHP. Use this function at your own risk.

Parameters

fetch_style

Controls the contents of the returned array as documented in PDOStatement::fetch(). Defaults to PDO_FETCH_BOTH.

Return Values

PDOStatement::fetchAll() returns an array containing all of the remaining rows in the result set. The array represents each row as either an array of column values or an object with properties corresponding to each column name.

Using this method to fetch large result sets will result in a heavy demand on system and possibly network resources. Rather than retrieving all of the data and manipulating it in PHP, consider using the database server to manipulate the result sets. For example, use the WHERE and SORT BY clauses in SQL to restrict results before retrieving and processing them with PHP.

Examples

Example 1. Fetch all remaining rows in a result set

<?php
$sth
= $dbh->prepare("SELECT name, colour FROM fruit");
$sth->execute();

/* Fetch all of the remaining rows in the result set */
print("Fetch all of the remaining rows in the result set:\n");
$result = $sth->fetchAll();
print_r($result);
?>

The above example will output:

Fetch all of the remaining rows in the result set:
Array
(
    [0] => Array
        (
            [NAME] => pear
            [0] => pear
            [COLOUR] => green
            [1] => green
        )

    [1] => Array
        (
            [NAME] => watermelon
            [0] => watermelon
            [COLOUR] => pink
            [1] => pink
        )

)

See Also

PDO::query()
PDOStatement::fetch()
PDOStatement::fetchSingle()
PDOStatement::prepare()
PDOStatement::setFetchMode()

Php pdostatement fetchall Function syntax tag

pdostatement fetchall php code on this is provided for your study purpose, it will guide you to know how create and design a website using php. use it to practice and train your self online



Php pdostatement fetchall syntax tutorial

php tutorial guide and code design are for easy learning and programming. The code practice section provided at the top is for practising of this syntax. Use the code section up to practice your php programming online. Learning php is very easy, all you need is to use the examples on this site and practice them to perfect your skills.


Function index

Variables

Expressions

Operators

Control-Structures

Cookies

Array

Date & Time

Directory function

File

Image

Operators

Form data handling

Mathematics operators

Mail

Php Mysql

Network Functions

Strings

php tutorial guides,functions, classes, code examples and tags for creating simple dynamic site to mysql database driven sites
 
 
Htaccess    html   Php    javascript   Asp   css    maths  Past Questions  Practice Tests Online