ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:replace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
v5:reference:connection:replace [2016/01/17 01:57] – ↷ Links adapted because of a move operation mnewnhamv5:reference:connection:replace [2024/03/04 02:44] (current) – second param is array, typos peterdd
Line 8: Line 8:
      int replace(      int replace(
          string $table,          string $table,
-         string $dataFields,+         mixed $dataFields,
          mixed $keyColumn,          mixed $keyColumn,
          optional bool $autoQuote = false,          optional bool $autoQuote = false,
Line 26: Line 26:
 The primary key field name or if compound key, an array of field names The primary key field name or if compound key, an array of field names
 ==== $autoQuote ==== ==== $autoQuote ====
-Set this value to true to use a hueristic to quote strings. Works with nulls and numbers but does not work with dates nor SQL functions.+Set this value to true to use a heuristic to quote strings. Works with nulls and numbers but does not work with dates nor SQL functions.
 ==== $primaryKeyIsAuto ==== ==== $primaryKeyIsAuto ====
 If the primary key is an auto-inc field, skip in insert. If the primary key is an auto-inc field, skip in insert.
Line 45: Line 45:
 $tableName = 'products'; $tableName = 'products';
 $indexColumn = 'product_code'; $indexColumn = 'product_code';
-$ar = array('product_code'=>10201,+$data = array('product_code'=>10201,
             'product_name' =>"'Nails'",             'product_name' =>"'Nails'",
             'price' => 3.99);             'price' => 3.99);
   
-$status = $db->replace($tableName,$ar ,$indexColumn);+$status = $db->replace($tableName, $data, $indexColumn);
 /* /*
  * Status code tells us if operation succeeded  * Status code tells us if operation succeeded
v5/reference/connection/replace.1452992252.txt.gz · Last modified: 2017/04/21 11:33 (external edit)