PHP Price not refreshing

APD Toronto
APD Toronto used Ask the Experts™
on
Hi Experts,

I have a PHP Page that gets its pricing from a DB, but when I update the DB, the prices on  the PHP do not change. However, if i open another browser or incognito, the new prices are there.

How do I fix this? Is it something with meta-refresh?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
This sounds like browser caching.  Are you using a CMS?  If so, can you flush the cache on that?
APD TorontoSoftware Developer

Author

Commented:
No, its custom script
It sounds like browser caching.  Can you post the script?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
This may sound a little daft, but you are refreshing your page after you've updated the Database ?? Updating the Database externally won't automatically push the changes to your browser - you need your browser to request them (by reloading / refreshing the page)
APD TorontoSoftware Developer

Author

Commented:
After updating the DB, I did F5 and Ctrl+F5 if that is what you mean
Most Valuable Expert 2018
Distinguished Expert 2018

Commented:
OK. Good stuff - just checking :)

We'll probably need to see your code to give you more advice
APD TorontoSoftware Developer

Author

Commented:
This is a very old script, but here it is

I am also wondering about ini_set() or something along those lines.

<?

session_start();

$varset = '1';

include_once("dbfunc.php");
include_once 'includes/APD_prices.php';
include_once ('includes/mode.php'); //New for promo

ConnectDB();

if(isset($_SESSION['uid']))

{



	if( $_SESSION['utype']=='member'){

	$sql = "SELECT * FROM members WHERE memId=" .$_SESSION['uid'];

	$cuser = mysql_query($sql) or die("Error : " .mysql_error());

	if(mysql_num_rows($cuser))

	{

		$user = mysql_fetch_array($cuser);

		$memberType = $user['memberType'];

		$businessName = $user['businessName'];

	}

	}

	else if($_SESSION['utype']=='agent')

	{

		$sql = "SELECT * FROM agents WHERE aid=" .$_SESSION['uid'];

		$cuser = mysql_query($sql) or die("Error : " .mysql_error());

		if(mysql_num_rows($cuser))

		{

			$user = mysql_fetch_array($cuser);

			//$memberType = $user['memberType'];

			$businessName = $user['fname']." ".$user['lname'];

		}

	}

}

//Query Products From Advertisement & Tour Packages Tables

$sqlTour = "SELECT * FROM tourpackages";

$recTour = mysql_query($sqlTour) or die('Error while retreiving Tour Packages ' . mysql_error());

//Query Products From Advertisement & Tour Packages Tables

$sqlM = "SELECT * FROM attractions WHERE category='Museums'";

$recM = mysql_query($sqlM) or die('Error while retreiving Attractions ' . mysql_error());

$sqlArt = "SELECT * FROM attractions WHERE category='Art Galleries'";

$recArt = mysql_query($sqlArt) or die('Error while retreiving Attractions ' . mysql_error());

$sqlHist = "SELECT * FROM attractions WHERE category='Historic Sites'";

$recHist = mysql_query($sqlHist) or die('Error while retreiving Attractions ' . mysql_error());

$sqlMj = "SELECT * FROM attractions WHERE category='Major Attractions'";

$recMj = mysql_query($sqlMj) or die('Error while retreiving Attractions ' . mysql_error());

$sqlT = "SELECT * FROM attractions WHERE category='Theatres'";

$recT = mysql_query($sqlT) or die('Error while retreiving Attractions ' . mysql_error());

$sqlB = "SELECT * FROM attractions WHERE category='Boat Cruises'";

$recB = mysql_query($sqlB) or die('Error while retreiving Attractions ' . mysql_error());

$sqlCity = "SELECT * FROM attractions WHERE category='City Tours'";

$recCity = mysql_query($sqlCity) or die('Error while retreiving Attractions ' . mysql_error());

$sqlSports = "SELECT * FROM attractions WHERE category='Sports Venues'";

$recSports = mysql_query($sqlSports) or die('Error while retreiving Attractions ' . mysql_error());

$sqlParks = "SELECT * FROM attractions WHERE category='Theme Parks'";

$recParks = mysql_query($sqlParks) or die('Error while retreiving Attractions ' . mysql_error());

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>

<title>ShopDineTour Toronto  - Discover The True Toronto (Sightseeing City Tours Canada)</title>
<LINK REV="made" href="mailto:ShopDineTour.com">
<META NAME="keywords" CONTENT="bus toronto tour,operator toronto tour,toronto bus tour discounts,canada toronto tour,toronto tour,bus from niagara toronto tour,toronto sightseeing,sightseeing city of toronto tours,sightseeing in toronto,sightseeing city toronto tours,visit toronto sightseeing,toronto sightseeing tours,toronto canada sightseeing,toronto attractions,toronto tourist attractions,attractions in toronto,attractions toronto,downtown toronto attractions,cheap toronto attractions,toronto area attractions,bus falls niagra tour,niagra wine tour,niagra falls tour,niagra+falls+tour,lake niagra tour wine,niagra falls boat tour,toronto shopping,shopping in toronto,toronto shopping malls,shopping malls in toronto,shopping toronto,toronto shopping guide,toronto tours,toronto bus tours,travel agency toronto tours,bus tours from toronto,tours in toronto,bus tours toronto,city toronto tour, grayline, hippo">
<META NAME="description" CONTENT="Jump on and jump off at over 20 locations throughout Toronto on one of our open top double decker buses. Visit the best attractions, sites, shopping, dining locations throughout Toronto, Canada - Voted Best City Tour of 2005">
<META NAME="ROBOTS" CONTENT="ALL">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script type="text/javascript" src="images/prototype.js"></script>

<script type="text/javascript" src="images/moo.js"></script>

<script type="text/javascript" src="images/moo_002.js"></script>

<script type="text/javascript">

<!--

//the main function, call to the effect object

	function init(){



		var stretchers = document.getElementsByClassName('stretcher'); //div that stretches

		var toggles = document.getElementsByClassName('display'); //h3s where I click on



		//accordion effect

		var myAccordion = new fx.Accordion(

			toggles, stretchers, {opacity: true, duration: 400}

		);



		//hash functions

		var found = false;

		toggles.each(function(h3, i){

			var div = Element.find(h3, 'nextSibling'); //element.find is located in prototype.lite

			if (window.location.href.indexOf(h3.title) > 0) {

				myAccordion.showThisHideOpen(div);

				found = true;

			}

		});

		if (!found) myAccordion.showThisHideOpen(stretchers[0]);

	}



function MM_openBrWindow(theURL,winName,features) { //v2.0

  window.open(theURL,winName,features);

}

//-->

</script>

<script type="text/JavaScript">

<!--

function MM_swapImgRestore() { //v3.0

  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

}



function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}



//-->

</script>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function popUp(URL) {

day = new Date();

id = day.getTime();

eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=<?php print "$vars[POP_WIDTH]";?>,height=<?php print "$vars[POP_HEIGHT]";?>');");

}

// End -->

</script>

<script language="javascript">



function checkValidity()

{

	if(document.login.uname.value=='' || document.login.uname.value.indexOf(' ')==0)

	{

		alert('User name cannot be blank');

		document.login.uname.focus();

		return false;

	}

	if(document.login.pwd.value=='' || document.login.pwd.value.indexOf(' ')==0)

	{

		alert('Please enter password');

		document.login.pwd.focus();

		return false;

	}

	return true;

}

function MM_checkBrowser(NSvers,NSpass,NSnoPass,IEvers,IEpass,IEnoPass,OBpass,URL,altURL) { //v5.0
  var newURL='', userAgent=navigator.userAgent, version=0;
  if (userAgent.indexOf('Netscape') != -1) {
  	version = parseFloat(userAgent.substring(userAgent.indexOf('Netscape')+9,userAgent.length));
    if (version >= NSvers) {if (NSpass>0) newURL=(NSpass==1)?URL:altURL;}
    else {if (NSnoPass>0) newURL=(NSnoPass==1)?URL:altURL;}
  } else if (userAgent.indexOf('MSIE') != -1) {
  	version = parseFloat(userAgent.substring(userAgent.indexOf('MSIE')+4,userAgent.length));
    if (version >= IEvers)
     {if (IEpass>0) newURL=(IEpass==1)?URL:altURL;}
    else {if (IEnoPass>0) newURL=(IEnoPass==1)?URL:altURL;}
  } else if (OBpass>0) newURL=(OBpass==1)?URL:altURL;
  if (newURL) { window.location=unescape(newURL); document.MM_returnValue=false; }
}
//-->

</script>

<link href="images/style3.css" rel="stylesheet" type="text/css">

<style type="text/css">
<!--
.border {
	border-left: solid #FFFFFF 1px;
	border-right: solid #999999 1px;
	border-top: solid #FFFFFF 1px;
	border-bottom: solid #999999 1px;
	background-color: #e2e2d5;
}
.heading {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	letter-spacing: 0px;
	color: #000000;
	margin-left: 0px;
	margin-bottom: 15px;
	text-align: center;
	vertical-align: middle;
	font-weight: bold;
	line-height: 13px;
}
.whiteheading {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	letter-spacing: 0px;
	color: #000000;
	margin-left: 0px;
	margin-bottom: 15px;
	text-align: center;
	vertical-align: middle;
	font-weight: bold;
	line-height: 13px;
}
.img-shadow1 {padding-left: 4px;
padding-right: 4px;
padding-top: 4px;
padding-bottom: 4px;
margin-top: 10px;
margin-left: 10px;
margin-right: 10px;

border: solid #CCCCCC 1px;
background-color: #FFFFFF;
}
.mainContent {
font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	color: #000000;
	padding: 5px;
}
.Btitle {
	font-family: Arial, Helvetica, sans-serif, Verdana;
	font-size: 20px;
	letter-spacing: 0px;
	color: #333333;
	margin-bottom: 15px;
	text-align: left;
	vertical-align: middle;
	font-weight: bold;
}
.Mtitle {
	font-family: Arial, Helvetica, sans-serif, Verdana;
	font-size: 17px;
	letter-spacing: 0px;
	color: #333333;
	margin-bottom: 15px;
	text-align: left;
	vertical-align: middle;
	font-weight: bold;
}
.Stitle {
	font-family: Arial, Helvetica, sans-serif, Verdana;
	font-size: 15px;
	letter-spacing: 0px;
	color: #0099FF;
	margin-bottom: 15px;
	text-align: left;
	vertical-align: middle;
	font-weight: bold;
}
body {
 margin:0;
 padding:0;
}

-->
</style>
</head>

<body>


<table width="942" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
  		<td width="942" align="center" valign="top">&nbsp;</td>
    </tr>

</table>
<? include("includes/header2.php"); ?>
<table width="942" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
    	<td width="194" align="left" valign="top" bgcolor="#FFFFFF"><? include("includes/leftmenu.php"); ?></td>
		<td width="24" align="center" valign="top" background="images/vertical.gif"></td>
        <td width="506" align="center" valign="top" bgcolor="#FFFFFF">
			<table width="506" border="0" cellspacing="0" cellpadding="0">
              	<tr>
                	<td height="15"></td>
                </tr>
                <tr>
                	<td width="504" align="left" valign="top" bgcolor="#FFFFFF">
                    <span class="Btitle">Buy Your Tour Tickets Now!</span><br /><span class="Stitle">Jump-on Jump-off Toronto Tour, Niagara Falls Tour, Toronto & Niagara Combo</span></td>
                </tr>
                <tr>
                    <td height="5"></td>
                </tr>
                <tr>
                	<td width="504" height="3" background="images/horizontal.gif"></td>
                </tr>
                <tr>
                	<td>

              			<div id="content">
                        <div style="overflow: hidden; visibility: hidden; opacity: 0; height: 0px;" class="stretcher">
						<table width="100%" border="0" cellspacing="1" cellpadding="2" class="mainContent">

			       

			        		<tr>
                            	<td>
                      				<table width="504" border="0" cellpadding="3" cellspacing="0">
										<tr bgcolor="#FFFFFF">
                                        	<td colspan="3" class="Mtitle">Jump-on Jump-off Toronto Tour</td>
										</tr>
										<tr bgcolor="#FFFFFF">
											<td width="25%" style="text-align: left;">Product Code :1</td><td colspan=2>&nbsp;</td>
                          				</tr>
                         				 
                                  		<tr>
                              				<td class="border" colspan="3">
			                    				<table cellpadding="2" cellspacing="1" border="0" width="100%">

			                          
														 
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblAd']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_Ad'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-Ad &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTT_Ad']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblAd'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSn']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_Sn'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-Sn &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTT_Sn']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblSn'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSt']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_St'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-St &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTT_St']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblSt'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblCh']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_Ch'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-Ch &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTT_Ch']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblCh'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblInf']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_Inf'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-Inf &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTT_Inf']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblInf'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblFam']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTT_Fam'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTT-Fam &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTT_Fam']) ?>&item=Jump-on+Jump-off+Toronto+Tour+-+ <?=urlencode($_SESSION['lblFam'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      
									              	</table>
								              	</td>
								              	
							              </tr>
							              <tr>
                                    		<td colspan="3" style="text-align: left;"> All listed prices are pre-HST.</td>
                                    	  </tr>
							              <tr bgcolor="#FFFFFF">
	                                        	<td colspan="3" class="Mtitle">Niagara Falls Tour</td>
										  </tr>
										  <tr bgcolor="#FFFFFF">
												<td width="25" style="text-align: left;">Product Code :2</td><td colspan="2"></td>
	                          			  </tr>
	                         			  
							              <tr>
							              		<td  class="border" colspan="3"> 
							              			<table cellpadding="2" cellspacing="1" border="0" width="100%">    
														
														  
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblAd']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_Ad'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-Ad &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTN_Ad']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblAd'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSn']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_Sn'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-Sn &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTN_Sn']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblSn'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSt']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_St'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-St &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTN_St']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblSt'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblCh']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_Ch'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-Ch &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTN_Ch']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblCh'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblInf']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_Inf'])?> Cdn                        </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-Inf &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTN_Inf']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblInf'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblFam']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTN_Fam'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTN-Fam &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTN_Fam']) ?>&item=Niagara+Falls+Tour+-+<?=urlencode($_SESSION['lblFam'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
														</table>
								              	</td>
							              	</tr>
							              	<tr>
                                    			<td colspan="3" style="text-align: left;"> All listed prices are pre-HST.</td>
                                    		</tr>
							              	<tr bgcolor="#FFFFFF">
		                                        	<td colspan="3" class="Mtitle">Toronto &amp; Niagara Combo Tour</td>
											  </tr>
											  <tr bgcolor="#FFFFFF">
													<td width="25" style="text-align: left;">Product Code :3</td><td colspan="2">&nbsp;</td>
		                          			  </tr>
		                         			  
											<tr>
							              		<td class="border" colspan="3"> 
							              			<table cellpadding="2" cellspacing="1" border="0" width="100%">			  
						              					<tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblAd']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_Ad'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-Ad &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTC_Ad']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblAd'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSn']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_Sn'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-Sn &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTC_Sn']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblSn'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblSt']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_St'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-St &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTC_St']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblSt'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblCh']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_Ch'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-Ch &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTC_Ch']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblCh'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblInf']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_Inf'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-Inf &prodPrice=<?=sprintf('%.2f', $_SESSION['priceSDTC_Inf']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblInf'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
									                      <tr bgcolor="#FFFFFF" class="border">
									                        <td class="mainContent"><?=$_SESSION['lblFam']?>                        </td>
									                        <td class="mainContent">$<?=sprintf('%.2f',$_SESSION['priceSDTC_Fam'])?> Cdn                         </td>
									                        <td align="right" class="formtext"><a href="/add2cart.php?cat=tourpackages &prodCat=SDTC-Fam &prodPrice=<?=sprintf('%.2f',$_SESSION['priceSDTC_Fam']) ?>&item=Toronto+%26+Niagara+Combo+Tour+-+<?=urlencode($_SESSION['lblFam'])?>" class="linksblue"><img src="buttons/buyNow.png" alt="Buy Now" width="109" height="22" border="0"></a></td>
									                      </tr>
							
			                                  </table>

                             				</td>
                             				

           								</tr>
            							<tr>
                                    		<td colspan="3" style="text-align: left;"> All listed prices are pre-HST.</td>
                                    	</tr>


			            			</table>
                            	</td>
							</tr>

			        

		          	</table>

			    </div>



			    		<p><br /></p>

                		<div align="center"></div>

              			</div>

              		<script type="text/javascript">

					Element.cleanWhitespace('content');

					init();

					</script>

         			</td>
      			</tr>
   			</table>
		</td>
		<td width="24" align="center" valign="top" background="images/vertical.gif"></td>
		<td width="194" align="right" valign="top" bgcolor="#FFFFFF">
			<table id="ProductsRight" width="194" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td width="194" align="left" valign="top" bgcolor="#FFFFFF"><? include("rightmenu.php"); ?></td>
        		</tr>
    		</table>
		</td>
	</tr>
</table>
<table width="942" align="center" cellpadding="0" cellspacing="0">
	<tr>
    	<td width="942" height="3" background="images/horizontal.gif"></td>
    </tr>
</table>
		<? include("includes/footer.php"); ?>

<div id="divPromo" style="display:block">
	
		<form name="frmPromo" id="frmPromo" method="post">
			<p>
			<label>Promo Code:</label>
			<input type="text" name="txtPromo" size="8" " />
			<input type="hidden" name="sess" value="<?php echo $_SESSION['cart_sess']; ?>" />
			<input type="submit" value="Apply" onclick="changePromo()" name="btnApplyPromo" />
			</p>
			<center><label style="font-weight: bold; color:red;"><?php echo $_SESSION['pMSG']; ?></label></center>
		</form>

</div>
</body>
</html>

Open in new window


includes/APD_prices.php
<?php

session_start();

include_once("dbfunc.php");
ConnectDB();

$_SESSION['lblFam'] = 'Family (2 Adults, 2 Children)';
$_SESSION['lblAd'] = 'Adult';
$_SESSION['lblSn'] = 'Senior (65&#43;)';
$_SESSION['lblSt'] = 'Student (with student I.D.)';
$_SESSION['lblCh'] = 'Children (3-12)';
$_SESSION['lblInf'] = 'Infant (under 3)';

if(empty($_SESSION['getRates']) || empty($_SESSION['getRatesTime']) || $_SESSION['getRatesTime'] < time()){
	UpdateRates();
}

function UpdateRates(){
	$pquery = "SELECT * FROM tblPrices WHERE fldProduct IN ('SDTT', 'SDTN', 'SDTC')";
	$presult = mysql_query($pquery);
	if(mysql_num_rows($presult) > 0) {
		while($row = mysql_fetch_object($presult)) {
		   	if($row->fldProduct == 'SDTT'){
		   	    $_SESSION['priceSDTT_Fam'] = $row->fldFamily;
				$_SESSION['priceSDTT_Ad'] = $row->fldAdult;
				$_SESSION['priceSDTT_Sn'] = $row->fldSenior;
				$_SESSION['priceSDTT_St'] = $row->fldStudent;
				$_SESSION['priceSDTT_Ch'] = $row->fldChild;
				$_SESSION['priceSDTT_Inf'] = $row->fldInfant;
		   	}
			if($row->fldProduct == 'SDTN'){
		   	    $_SESSION['priceSDTN_Fam'] = $row->fldFamily;
				$_SESSION['priceSDTN_Ad'] = $row->fldAdult;
				$_SESSION['priceSDTN_Sn'] = $row->fldSenior;
				$_SESSION['priceSDTN_St'] = $row->fldStudent;
				$_SESSION['priceSDTN_Ch'] = $row->fldChild;
				$_SESSION['priceSDTN_Inf'] = $row->fldInfant;
		   	}
			if($row->fldProduct == 'SDTC'){
		   	    $_SESSION['priceSDTC_Fam'] = $row->fldFamily;
				$_SESSION['priceSDTC_Ad'] = $row->fldAdult;
				$_SESSION['priceSDTC_Sn'] = $row->fldSenior;
				$_SESSION['priceSDTC_St'] = $row->fldStudent;
				$_SESSION['priceSDTC_Ch'] = $row->fldChild;
				$_SESSION['priceSDTC_Inf'] = $row->fldInfant;
		   	}
	   }
	}
	$_SESSION['getRates'] = 1;
	$_SESSION['getRatesTime'] = strtotime('+1 hours');
	
	$tquery = "SELECT * FROM tblTaxes";
	$tresult = mysql_query($tquery);
	while($row = mysql_fetch_object($tresult)) {
		if($row->fldID == 1){
	   	    $_SESSION['strTax1'] = $row->fldName;
			$_SESSION['dblTax1'] = $row->fldRate;
			$_SESSION['bolTax1'] = $row->fldActive;
	   	}
		if($row->fldID== 2){
	   	    $_SESSION['strTax2'] = $row->fldName;
			$_SESSION['dblTax2'] = $row->fldRate;
			$_SESSION['bolTax2'] = $row->fldActive;
	   	}
		if($row->fldID == 3){
	   	    $_SESSION['strTax3'] = $row->fldName;
			$_SESSION['dblTax3'] = $row->fldRate;
			$_SESSION['bolTax3'] = $row->fldActive;
	   	}
	}
}

//$_SESSION['priceSDTT_Fam'] = 119.47;
//$_SESSION['priceSDTT_Ad'] = 41.15;
//$_SESSION['priceSDTT_Sn'] = 37.17;
//$_SESSION['priceSDTT_St'] = 37.17;
//$_SESSION['priceSDTT_Ch'] = 23.00;
//$_SESSION['priceSDTT_Inf'] = 0;
//
//$_SESSION['priceSDTN_Fam'] = 250.44;
//$_SESSION['priceSDTN_Ad'] = 83.19;
//$_SESSION['priceSDTN_Sn'] = 78.76;
//$_SESSION['priceSDTN_St'] = 74.33;
//$_SESSION['priceSDTN_Ch'] = 53.10;
//$_SESSION['priceSDTN_Inf'] = 0;
//
//$_SESSION['priceSDTC_Fam'] = 330.97;
//$_SESSION['priceSDTC_Ad'] = 110.62;
//$_SESSION['priceSDTC_Sn'] = 104.42;
//$_SESSION['priceSDTC_St'] = 99.12;
//$_SESSION['priceSDTC_Ch'] = 68.14;
//$_SESSION['priceSDTC_Inf'] = 0;
//


?>

Open in new window

Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
OK. I'm guessing the problem is because you're storing the prices in the session. You only update the prices in that session (re-query the database) if any of the following are true:

if(empty($_SESSION['getRates']) || empty($_SESSION['getRatesTime']) || $_SESSION['getRatesTime'] < time()){

The reason your code works if you open another browser or incognito windows is because you're no longer using the same session data - you've effectively started a fresh session.

I don't know how you're updating your DB, or where you're setting those session variables, but you'll probably need to clear them down when you call the code that updates the prices in the DB.

You might also want to consider NOT storing them in the session at all, and just query the DB when you need them
APD TorontoSoftware Developer

Author

Commented:
Thank you Chris.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial