Jump to content

Calculations no longer working.


Lostnode

Recommended Posts

Ok, I made some changes to my code (change in variable names only) and now it doesn't seem to work.

 

Here is the code.

 

<?php
if ($_REQUEST['postal'] != "" && $_REQUEST['lbs'] != "") {
$postal = $_REQUEST['postal'];
$lbs = $_REQUEST['lbs'];
$type = $_REQUEST['type'];
if ($type == "splist") {
	$ztype = "cansp_zone" ;
	$lbstype = "sp";
	} else {
	$ztype = "canmp_zone";
	$lbstype = "mp";
	}
$qP1 = "SELECT * FROM " . $dbprefix . "_canzones WHERE canzone_postal = '$postal'  "; $which = $handle_db2;
$rsP1 = mysql_query($qP1,$which);
if (mysql_num_rows($rsP1) > 0) {

$row1 = mysql_fetch_array($rsP1);

extract($row1);
$prov = trim($canzone_prov);
$zone = trim($canzone_zone);

$dzone = $ztype.$zone;
$dlbs = "can" . $lbstype . "_lbs";


$query = "SELECT $dzone FROM " . $dbprefix . "_can" . $type . " WHERE $dlbs = '$lbs'  "; $which = $handle_db2;
    $result = mysql_query ($query,$which);
    $row = mysql_fetch_array($result);
    $dzone = $row[0];

$qP3 = "SELECT * FROM settings WHERE storeid = '$dbprefix'  "; $which = $handle_db2;
$rsP3 = mysql_query($qP3,$which);
$row3 = mysql_fetch_array($rsP3);
extract($row3);
$taxsetting = trim($taxsetting);
$gst = trim($gst);
$pst = trim($pst);
$hst = trim($hst);
$cp_fuelcharge = trim($cp_fuelcharge);
$cp_markup = trim($cp_markup);

include("./inc/taxcalc.php");
include("./inc/markcalc.php");

 

./inc/markcalc.php is as follows:

<?php
if ($cp_markup != "") {
$cp_mark = ($dzone * ($cp_markup / 100));

 

When I output $cp_mark, it comes out as the same value as $cp_markup

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/217359-calculations-no-longer-working/
Share on other sites

I was going to suggest that it sounded like $dzone was 100.

 

When your code does not produce the results you expect, you should always check what values your code IS using because we would need to know that as well in order to tell you why your code is producing the unexpected results.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.