FluentPDO::update PHP Method

update() public method

Create UPDATE query
public update ( string $table, array | string $set = [], string $primaryKey = null ) : UpdateQuery
$table string
$set array | string
$primaryKey string
return UpdateQuery
    public function update($table, $set = array(), $primaryKey = null)
    {
        $query = new UpdateQuery($this, $table);
        $query->set($set);
        if ($primaryKey) {
            $primaryKeyName = $this->getStructure()->getPrimaryKey($table);
            $query = $query->where($primaryKeyName, $primaryKey);
        }
        return $query;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Performs an update query using FluentPDO
  */
 public function update($table, array $data, $key, $keyValue = null)
 {
     if (!$this->isConnected()) {
         static::connect();
     }
     $this->num_queries++;
     return $this->fpdo->update($table)->set($data)->where($key, $keyValue)->execute();
 }
All Usage Examples Of FluentPDO::update