Skip to content

Update function issues #5

@mikegiddens

Description

@mikegiddens

I would suggest making these changes to the update function. Remove the lastID since this is an update statement and is not needed. Also adding single quotes to the values so that it does not crash on string values.

  public function updateRow($table, $row_id, $data) {
    $keys = implode(',', array_keys($data));
    $values = implode('\',\'', array_values($data));
    $sql = "UPDATE $table SET ($keys) = ('$values') WHERE cartodb_id = $row_id;";
#    $sql .= "SELECT $table.cartodb_id as id, $table.* FROM $table ";
#    $sql .= "WHERE cartodb_id = currval('public." . $table . "_cartodb_id_seq');";
    return $this->runSql($sql);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions