there is only one place this code is called in AwoCoupon, and if you are having this error, then you must be calling the coupon code function outside of virtuemart. Try this to see if it fixes the problem:
in www/administrator/components/com_awocoupon/assets/virtuemart/ps_coupon.php, around line 1297 is this code
<?php
$db = new ps_DB;
if( $auth["user_id"] > 0 ) {
$q = "SELECT state, country FROM #__{vm}_user_info WHERE user_id='". $auth["user_id"] . "'";
$db->query($q);
$db->next_record();
$state = $db->f("state");
$country = $db->f("country");
$q = "SELECT tax_rate FROM #__{vm}_tax_rate WHERE tax_country='$country' ";
if( !empty($state)) {
$q .= "AND (tax_state='$state' OR tax_state=' $state ' OR tax_state='-')";
}
$db->query($q);
if ($db->next_record()) {
$my_taxrate = $db->f("tax_rate");
}
else {
$my_taxrate = 0;
}
}
?>
change it completely to this
<?php
$db = & JFactory::getDBO();
if( $auth["user_id"] > 0 ) {
$db->setQuery("SELECT state, country FROM #__vm_user_info WHERE user_id='". $auth["user_id"] . "'");
$tmp = $db->loadObject();
@$state = $tmp->state;
@$country = $tmp->country;
$q = "SELECT tax_rate FROM #__vm_tax_rate WHERE tax_country='$country' ";
if( !empty($state)) {
$q .= "AND (tax_state='$state' OR tax_state=' $state ' OR tax_state='-')";
}
$db->setQuery($q);
$my_taxrate = (float)$db->loadResult();
}
?>