Lostnode Posted October 31, 2010 Share Posted October 31, 2010 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 More sharing options...
Lostnode Posted October 31, 2010 Author Share Posted October 31, 2010 So lets say $dzone = 50 and $cp_markup = 10 (%) The eqation should be $cp_mark = (50 * (10 / 100)) $cp_mark = (50 * 0.1) $cp_mark = 5 However $cp_mark is turning out to = $dzone $sp_mark = 50 ???? Link to comment https://forums.phpfreaks.com/topic/217359-calculations-no-longer-working/#findComment-1128670 Share on other sites More sharing options...
Lostnode Posted October 31, 2010 Author Share Posted October 31, 2010 Never mind... seems my collegue when demoing the old product changed the markup to 100%, there for the markup = the original price.... I wish people would inform me when they change the data... Link to comment https://forums.phpfreaks.com/topic/217359-calculations-no-longer-working/#findComment-1128672 Share on other sites More sharing options...
PFMaBiSmAd Posted October 31, 2010 Share Posted October 31, 2010 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 https://forums.phpfreaks.com/topic/217359-calculations-no-longer-working/#findComment-1128674 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.