I'm working against a database which is empty except for whatever I put into it, so there's no problem putting in whatever I feel like and as such there is absolutely no problem deleting all entries from any table.
The table which I'm trying to run the update query against looks as follows:
projID bigint(20)
lightID bigint(20)
oID bigint(20)
units mediumint(9)
cost double
currencyID smallint(5)
costType set('setUnitCost', 'unitCostHour', 'unitCostDay', 'unitCostWeek',
'unitCostMonth', 'BUR')
startDate datetime
endDate datetime
And the php code:
public function UpdateProjectLights($qry, &$data) {
/* ORIGINAL FUNCTIONALITY. RESTORE AFTER CHECK
$this->mDoProject->UpdateProjectLights($qry, $data);
*/
require_once('./include/config.inc.php');
require_once('DB.php');
$db = DB::connect(MYSQL_CONNECTION_STRING,
USE_PERSISTENT_CONNECTIONS);
if (DB::isError($db))
trigger_error($db->getMessage(), E_USER_ERROR);
$db->setFetchMode(DB_FETCHMODE_ASSOC);
echo '$qry:' . $qry . "<br/>";
echo '$data[0][$i]:<br/>';
for ($i = 0; $i < count($data[0]); $i++) {
echo ' $i = ' . $i .": " . $data[0][$i] . "<br/>";
}
echo "<br/>";
$prep = $db->prepare($qry, $data);
if(DB::isError($prep))
trigger_error($prep->getMessage(), E_USER_ERROR);
else echo "Success: statement prepared<br/>";
$result = $db->executeMultiple($prep, $data);
if(DB::isError($result))
trigger_error($result->getMessage(), E_USER_ERROR);
else echo "Success: statement executed<br/>";
$this->db->disconnect();
}
Which outputs:
$qry: UPDATE ProjectLight SET oID = ?, units = ?, cost = ?, currencyID = ?,
costtype = ?, startDate = ?, endDate = ? WHERE projID = ? AND lightID = ?
$data[0][$i]:
$i = 0: 1
$i = 1: 2
$i = 2: 100
$i = 3: 3
$i = 4: 'unitCostHour'
$i = 5: '2007-07-02 00:00:00'
$i = 6: '2007-07-04 00:00:00'
$i = 7: 10
$i = 8: 1
Success: statement prepared
ERRNO: 256
TEXT: DB Error: unknown error
LOCATION: bo_project.php, line 190, atJuly 11, 2007, 11:45 pm
Showing backtrace: