Thursday, February 17, 2011

joomla1.6 database changes from joomla1.5?

here i am going to give some detail about joomla1.6 database changes compare to joomla1.5.

in joomla1.6 they introduce new query builder class. that class allow you to develop better understandable query format rather than normal query.

in joomla1.5 we can build the query like this:

$db = JFactory::getDbo();
$db->setQuery(
'SELECT *'.
' FROM #__menu'.
' WHERE published = '.(int) $published.
' AND id = '.(int) $ItemId.
);


in joomla1.6 we can build using the new query class:

$db = JFactory::getDbo();
$query = $db->getQuery(true);

$query->select($db->nameQuote('link'));
$query->from($db->nameQuote('#__menu'));
$query->where($db->nameQuote('published') . '=1');
$query->where($db->nameQuote('id') . '=' . $db->quote($itemid));

No comments:

Post a Comment