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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.