Posted By

anagaiyahoocom on 05/14/11


Tagged

joomla


Versions (?)

Updating Table Using JDatabase::updateObject() in Joomla


 / Published in: PHP
 

  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  

You need to login to post a comment.