Method:
updateSingle()
Class:
SQL
Method Call:
include_once("core/sql/SQL.php");
$db = new SQL();
$db->updateSingle(STRING: $table, STRING: $setString, [STRING: $condition]);
Description:
Execute an UPDATE statement.
$setString is a string such as "field=value" that has been suitably formatted with formatField() and tidyInput() methods. Unlike update(), updateSingle() is intended for quickly updating just one field in a database table.
Usage:
For example (assuming the database object exists within a class as $this->db):
$subTitle = "Beginner's Guide"; $table = "WKX_resource"; $setString = $this->db->formatField('subtitle') ."=" . $this->db->tidyInput($subTitle); $condition = "WHERE " . $this->db->formatField('id') . "=" . $this->db->tidyInput(666); $this->db->updateSingle($table, $setString, $condition);