Personal tools
From wiki.swiftlytilting.com
Jump to: navigation, search

WinBinder Manual/db edit record

Edits a record in a table.

Syntax

int db_edit_record(string tablename, int id [, mixed fieldnames [, mixed fieldvalues [, string idfield]]])

Arguments

  • tablename is the name of the table that will be affected.
  • id is the id number of the record to be edited.
  • fieldnames is a set of identifiers that may be an array or a CSV string (without the "id" field).
  • fieldvalues is a string with the values of the records desired. It may be an array or a CSV string.
  • idfield is the name of identifier field (column). Default is "id" .

The table below summarizes the options for fieldnames and fieldvalues.

fieldnames

fieldvalues

Data inserted

null

null

a record with all fields "0"

null

string array

a record with all fields with their fieldvalues

string array

string array

a record with fieldnames with their fieldvalues

Result

The result will be the actual id or FALSE, if the record could not be edited.

Example

// Edit value of "name" in 3. record in mytable

$fn = "name");
$fv = "shed";
$res = db_edit_record("mytable",3, $fn, $fv);
echo ("id is $res "); 

See also


Winbinder Projects