Hi ppl, I am updating a database with the following:
$lines = file ('../includes/new1.csv'); foreach ($lines as $line_num => $line) { list($npr_nr,$npr_exvat,$npr_desc) = explode(",",$line); $query = "SELECT product_id,product_nr, product_cost_exvat, product_description, product_price, updated from products where products.product_nr = '$npr_nr'"; $oldprs = mysql_query ($query, $db_connection) or die (mysql_error()); while (list ($oldprs_id, $oldprs_nr, $oldprs_exvat, $oldprs_desc, $oldprs_price, $updated) = mysql_fetch_row ($oldprs)) echo "This is oldprs: $oldprs_id, $oldprs_nr - and this is npr_pr: $npr_nr<br>"; $incvat = bcmul('$npr_exvat', '1.14',2); $markup = bcdiv('$oldprs_price', '$incvat',4); $profit = bcsub('$oldprs_price', '$incvat' ,2); echo "$npr_exvat, $oldprs_price, $incvat <br>"; mysql_query ("UPDATE products SET product_cost_exvat = '$npr_exvat', product_description = '$npr_desc', product_markup = '$markup',product_profit = '$profit', product_cost_incvat = '$incvat', updated = '1' WHERE product_nr = '$npr_nr'",$db_connection) or die (mysql_error()); } echo "Your query executed successfully. <a href=\"index.php\">click here to return</a>"; everything works except the bcmath functions they make all 3 variables = 0.0000 or 0.00 Any help would be much appreciated. Thanks Adriaan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php