Code: Select all
function calc_tax($amount) {
if (!isset($_SESSION['tax'])) {
$sql = 'SELECT amt FROM price_functions WHERE descr = \'tax\'';
$result = mysql_query($sql) or die (mysql_query.mysql_error());
if ($result) { $tax_rate = mysql_query($result); }
} else { $tax_rate = $_SESSION['tax']; }
$amount_w_tax = ($amount * $tax_rate);
return $amount_w_tax;
}I know this is childs play for most of you, and aside from the query itself, I'm sure this whole function is sideways.
If i put $result or $sql as a parameter for mysql_result() I get an invalid parameter error message, every other mysql_x function I put in there just returned a NULL value on var_dump($tax_rate)
I appreciate any help I can get, thanks.
(i'm sorry, I can't figure out why my code is all green either. I have it nested in
Code: Select all