020 555 1111
  • Old fashion, modular, procedural PHP plus some scaffolding techniques to allow it to mimic MVC simplicity.
  • A quick reference to help you find in PHP maze what needs to be done and how to do it.
  • Learn a PHP Object Oriented Programming by building a live discussion forum application.
  • MVC - Model View Controller - real life, easy reference and application.
This product has options, take a look at them and select ones you like the most.
Options are displayed under image section.

PDO::CONSTANTS - summary
[MySQL PDO Const]

Pass value parameters

  • PDO::PARAM_BOOL (for booleans)
  • PDO::PARAM_NULL (for SQL NULL)
  • PDO::PARAM_INT (for SQL INTEGER)
  • PDO::PARAM_STR (for string types)
  • PDO::PARAM_LOB (for Large OBject types)
  • PDO::PARAM_STMT (for a recordset type, currently not supported)
  • PDO::PARAM_INPUT_OUTPUT (for an INOUT parameter of a Stored Procedure)

 

Fetch result parameters

 

Primitive fetch options
  • PDO::FETCH_ASSOC 
    Specifies that the fetch method shall return each row as an array indexed by column name as returned in the corresponding result set. 
    If the result set contains multiple columns with the same name, PDO::FETCH_ASSOC returns only a single value per column name. 
  • PDO::FETCH_NAMED 
    Specifies that the fetch method shall return each row as an array indexed by column name as returned in the corresponding result set. 
    If the result set contains multiple columns with the same name, PDO::FETCH_NAMED returns an array of values per column name. 
  • PDO::FETCH_NUM 
    Specifies that the fetch method shall return each row as an array indexed by column number as returned in the corresponding result set, starting at column 0. 
  • PDO::FETCH_BOTH
    Specifies that the fetch method shall return each row as an array indexed by both column name and number as returned in the corresponding result set, starting at column 0.

 

Extended fetch options
  • PDO::FETCH_COLUMN
    Specifies that the fetch method shall return only a single requested column from the next row in the result set. 
  • PDO::FETCH_BOUND
    Specifies that the fetch method shall return TRUE and assign the values of the columns in the result set to the PHP variables to which they were bound with the PDOStatement->bindParam() or PDOStatement->bindColumn() methods.
  • PDO::FETCH_KEY_PAIR
    Fetch into an array where the 1st column is a key and the 2nd column the value.
    Throws a PDOException if more than 2 columns are requested in the SQL.
 
 
"Operational" fetch options
  • PDO::FETCH_CLASS
    Specifies that the fetch method shall return a new instance of the requested class, mapping the columns to named properties in the class. 
  • PDO::FETCH_OBJ
    Same as PDO::FETCH_CLASS using "stdClass"
  • PDO::FETCH_FUNC
    Returns the results of calling the specified function, using each row's columns as parameters in the call. 
  • PDO::FETCH_INTO
    Specifies that the fetch method shall update an existing instance of the requested class, mapping the columns to named properties in the class. 
  • PDO::FETCH_SERIALIZE
    Same as PDO::FETCH_INTO but object is provided as a serialized string.
  • PDO::FETCH_LAZY
    Specifies that the fetch method shall return each row as an object with variable names that correspond to the column names returned in the result set. PDO::FETCH_LAZY creates the object variable names as they are accessed.
 
 
Combined fetch options
  • PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE
    Executes the class’ constructor before the class members are populated from the DB.
  • PDO::FETCH_CLASS | PDO::FETCH_CLASSTYPE
    Determine the class name from the value of first column. 
  • PDO::FETCH_COLUMN | PDO::FETCH_UNIQUE
    Fetch only the unique values of a single column from the result set.
  • PDO::FETCH_COLUMN | PDO::FETCH_GROUP
    Return an associative array grouped by the values of a specified column.

 

 

 

Functions with similar functionality

PDOStatement->fetchColumn() shorthand for PDO::FETCH_COLUMN
PDOStatement->fetchObject() shorthand for PDO::FETCH_OBJ or PDO::FETCH_CLASS