Database not updating before the page reloads?

Discussion in 'PHP' started by Greenmethod, Oct 11, 2007.

  1. #1
    I have a page that updates the database with the info that is input into the form, then goes back to a page that has a table that outputs the info. When it goes back to that page, the info is not changed, but if I go back to the search page and find it, it is changed... any ideas? Here is the code that updates the info...

    	{
    		$shop = $_POST["shop"];
    		$email = $_POST["email"];
    		$owner = $_POST["owner"];
    		$owner_home = $_POST["owner_home"];
    		$owner_cell = $_POST["owner_cell"];
    		$manager = $_POST["manager"];
    		$manager_cell = $_POST["manager_cell"];
    		$address = $_POST["address"];
    		$city = $_POST["city"];
    		$state = $_POST["state"];
    		$zip = $_POST["zip"];
    		$shop_num = $_POST["shop_num"];
    		$shop_fax = $_POST["shop_fax"];
    		$windows = $_POST["windows"];
    		$support = $_POST["support"];
    		$pager = $_POST["pager"];
    		$lic_dt = $_POST["lic_dt"];
    		$sup_cost = $_POST["sup_cost"];
    		echo $sup_cost;
    		$bill_add = $_POST["bill_add"];
    		$bill_city = $_POST["bill_city"];
    		$bill_state = $_POST["bill_state"];
    		$bill_zip = $_POST["bill_zip"];
    		$former_name = $_POST["former_name"];
    		$chain = $_POST["chain_store"];
    		$result = mysql_query("SELECT * FROM customer WHERE shop LIKE '%$chain%'") or die(mysql_error()); //selects row for chains
    		$row = mysql_fetch_array($result);
    		if (0 == strlen($chain_store))
    			{ $chain_store = 0; }
    		else
    			{ $chain_store = $row['chain_store']; } //selects the chain number
    		echo "Customer has been updated.";
    		mysql_query("UPDATE `customer` SET `shop`='$shop', `email`='$email', `owner`='$owner', `owner_home`='$owner_home', `owner_cell`='$owner_cell', `manager`='$manager', `manager_cell`='$manager_cell', `address`='$address', `city`='$city', `state`='$state', `zip`='$zip', `shop_num`='$shop_num', `shop_fax`='$shop_fax', `windows`='$windows', `support`='$support', `pager`='$pager', `lic_dt`='$lic_dt', `sup_cost`='$sup_cost', `bill_add`='$bill_add', `bill_city`='$bill_city', `bill_state`='$bill_state', `bill_zip`='$bill_zip', `former_name`='$former_name', `chain_store`='$chain_store' WHERE `cust_no`='$cust_no' LIMIT 1") or die(mysql_error());
    
    		?>
    		<script language="JavaScript">
    		setTimeout("top.location.href = 'cust_info.php'",3000);
    		</script>
    		<?
    	}
    PHP:
    It gives no mysql error...
     
    Greenmethod, Oct 11, 2007 IP
  2. tamen

    tamen Peon

    Messages:
    182
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try using the PHP functione header location to send the browser back. I think the problem is the browser cache.
     
    tamen, Oct 11, 2007 IP
  3. Squash

    Squash Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Pleae try to use following php code when you need to redirect user

    
    header('Location: cust_info.php');
    die();
    
    PHP:
    insted of JavaScript redirect.
     
    Squash, Oct 12, 2007 IP