I am writing a php powered cash register that will be used for my school store. They scan the barcode information, it's sent to multiple scripts using AJAX, and the output is displayed on the screen (items bought, tax, subtotal, total, etc...). One of the files it sends data to is price.php, which takes in a barcode ($id) and the price of the product ($x - which isn't really necessary, it was just an old variable i planned on using but i think i took it out). the problem is it isn't displaying things 'up-to-date'. lets say i added the first product, which cost 15.99. it would return 0 for tax, subtotal, and total. then if you scanned that same product again, it would then display subtotal 15.99, tax .95, and total 16.94, even though it is really subtotal 31.98, tax 1.9, and total 33.88, which is the correct data that is held in the cookie. I am wondering why, even though it's pulling the data from the cookie, the output on the screen is different than is what is in the cookie. Maybe it takes time for the cookie to register/update? If anyone can help me with this that would be great
PHP Code:
<?php
// Price.php
define("DB_SERVER", "localhost"); // Server
define("DB_USER", "root"); // Username
define("DB_PASS", ""); // User pass
define("DB_NAME", "products"); // Database
mysql_connect(DB_SERVER, DB_USER, DB_PASS) or die(mysql_error()); // Connection
mysql_select_db(DB_NAME) or die(mysql_error()); // Selection of database
It is possible that the cookies are not being overwritten (or are) - Try using a session array if possible with a unique identifier (such as $_SESSION['something1']['something2'] = 'value' - or similar)
If you do, don't forget to use session_start();
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self