Hello,
I have a question ragarding to the update of database fields. How far I can see there are multiple possibilities to update a row. Here are two examples:
1.
2.
What is the better solution for an update? ... and why is this the better solution? When I have to use the first example and when the second one?
I have a question ragarding to the update of database fields. How far I can see there are multiple possibilities to update a row. Here are two examples:
1.
PHP:
$dwPost = XenForo_DataWriter::create('XenForo_DataWriter_DiscussionMessage_Post');
$dwPost->setExistingData($post['post_id']);
$dwPost->set('post_date', XenForo_Application::$time);
$dwPost->save();
2.
PHP:
$db->update('xf_post', array('post_date' => XenForo_Application::$time), 'post_id = '.$db->quote($post['post_id']));
What is the better solution for an update? ... and why is this the better solution? When I have to use the first example and when the second one?