Updating Table Using JDatabase::updateObject() in Joomla


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. //Create row object
  2. $db = JFactory::getDBO();
  3. $row = new JObject();
  4. $row->id = (int)$user->id;
  5. $row->title = 'My Favorites';
  6. $row->alias = JFilterOutput::stringUrlSafe($row->title); //format in slashed alias format
  7. $row->default = 1;
  8.  
  9. //third parameter is key field
  10. $ret = $db->updateObject('#__jxgallery_lightboxes', $row, 'id');
  11.  
  12. if (!$ret) {
  13. $this->setError($db->getErrorMsg());
  14. return false;
  15. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.