Skip to content

ExportDB

Mehdi Bounya edited this page Jul 14, 2018 · 2 revisions

The \PHPForms\ExportDB() class is used to export data to a database.

Content

\PHPForms\ExportDB() methods

construct

  • Arguments:
    • PDO $pdo: The PDO instance.
    • string $table_name = null: Table name.
    • array $data = []: Data to be exported.
    • array $map = []: A map for the data. Read more here

addData

  • Arguments:
    • string $name: The field name
    • string $value: Field's value

Add data to be exported, if data exists with the same field name its value will be replaced.

setMap

  • Arguments:
    • array $map: Map to set

Add a map to the exporter, if a map already exists it will be overwritten. More on maps

setTable

  • Arguments:
    • string $table: Table name

Set the table name where to save the data.

export

  • Returns: bool

Inserts the data into a database, return TRUE on success or FALSE otherwise. The data will be escaped automatically by PDO. Field names and the table name are escaped too and surrounded by backticks `.

Clone this wiki locally