$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('custom_field_1')))
->from($db->quoteName('#__package_detail'))
->where($db->quoteName('name') .'='. $db->quote($package))
->order('ordering ASC');
$db->setQuery($query);
$expresult = $db->loadResult();
When you write sql query. You will always see quoteName from it right.
But, do you know what is the function of quoteName?
Below list can let you easily to understand it
quoteName = table name / column name
quote = variable (string)
int = number
So, when you target is table / column name, you should use quoteName
when you target is variable like string ($name), you should use quote
when you target is integer, you should use int
Below are the example:
$db->quoteName('name')
$db->quote('$name')
$db->int(2)