I have some code to update a table:
$updateLastAttempt = new stdClass();
$tempDate = new DateTime('now');
$formattedDate = $tempDate->format('Y-m-d H:i:s');
$updateLastAttempt->id = $pxobjUpdate->id;
$updateLastAttempt->last_attempted_sms = "" . $formattedDate . "";
array_push($uniqueIdArray,$pxuniqueid);
array_push($recallRecordIdArray,$recallRecordid);
if ($debug != 1) {
echo"<br>Update last attempt date to:".$formattedDate." for id:".$pxuniqueid. " recall Record id:".$recallRecordid;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('last_attempted_sms') . ' = "' . $formattedDate.'"',
);
$conditions = array(
$db->quoteName('id') . ' = "'.$pxobjUpdate->id.'"',
);
$query->update($db->quoteName('#__patientrecalls_px_record'))->set($fields)->where($conditions);
$db->setQuery($query);
$result = $db->execute();
}
Originally I used an object and did an update that way but I was getting errors so I switched to this proceedural method. It's a joomla 3 site (I know it should be updated).
The problem I'm having is that not all of the records are updating. It seems to just ignore the update for a random number of records. It updates most of them but not all of them and I can't see anything that might cause this. It's just a straight up record update by using the id .
any ideas??