SproutCMS

This is the code documentation for the SproutCMS project

function csv()

Exports a database query result as a CSV file.

Usage

bool|string QueryTo::csv ( PDOStatement|array $result , array $modifiers , array $headings );

Arguments

  1. PDOStatement|array $result
    Result set. N.B. the cursor on this statement WILL BE CLOSED by this function.
  2. array $modifiers
    ColModifier objects to apply result set before exporting their values,
           as column_name => ColModifier instance
  3. array $headings
    Headings to use on the first row of the CSV; as column_name => heading.
           The column name itself will be used if a specific heading isn't requested.

Return value

  • string
    The CSV file
  • bool
    False on error