Programming Reference:Functions:CCBuildUpdate
From CodeCharge Studio Community Wiki
Description
Constructs the SQL necessary to do a database update.
Location
Common
Syntax
CCBuildInsert(table, fields, connection);
Return value
String
Parameters
| Name | Type | Description | Required |
| table | string | The name of the table to update. | Yes |
| fields | array | An array holding the field names and their values. | Yes |
| connection | variable | Name of the connection to use. | Yes |
See also:
CCBuildInsert, CCBuildSQL
PHP
//A crude sample:
global $DBIntranetDB();
$db = new clsIntranetDB();
$db->UpdateFields["Field1"]["Values"] = "inny";
$db->UpdateFields["Field2"]["Values"] = "meeny";
$db->UpdateFields["Field3"]["Values"] = "miny";
$db->UpdateFields["Field4"]["Values"] = "moe";
$db->SQL = CCBuildUpdate("MyTable", $db->UpdateFields, $db);
if ($db->Where) {
$db->SQL .= $db->Where;
}
$db->query($db->SQL);