Fixed some errors in the $db call

...er for Joomla 1.5