Wiki

Clone wiki

prep / Prep_class / updateone_func

Prep::updateOne method

bool Prep::updateOne(~prep\Table $table, int $ID, mixed $fields[, null, null, PDO $PDO[, string $field_ID]]);
bool Prep::updateOne(array $arguments);

Inits a prep\Query object, executes it with the prep\Query::exec method on a single row.
This is a method of the Prep class.
This method is static.

Reference

Arguments

  1. ~prep\Table $table The table used for the query
  2. int $ID The unique identifier for the row you want to update. The column checked is $field_ID
  3. mixed $fields
    • ~prep\Field The one field you want to update
    • array
      • associative array
        • key represents the field name
        • value represents the new value of the field (The string values will be protected from SQL injection)
      • list of ~prep\Field The fields you want to update
      • Both of the above
  4. Ignored argument
  5. Ignored argument
  6. PDO $PDO
    • Required if the default Prep::$PDO is not set
    • If provied, will override the default one if is a (subclass of) PDO
  7. string $field_ID Default is ID! The name of the column containing the identifier of the row you want to select. As the limit is set to 1, you would rather choose a column with an unique index (or primary).

⇒ The arguments may be given as well as different arguments or into one single array as documented in prep\ArgumentException::checkArgs

Returned value

A bool : true if the update was successful.

Exception throwing

Exemples

To be continued...

It has basically have the same expected arguments as Prep::update. You should read its documentation and exemples.

See also

Updated