PHP - Moved: Jquery Version Conflict Problem
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=353342.0 Similar TutorialsThis topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=334005.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359402.0 This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=318815.0 Hi Everyone, I'm building a custom shopping cart. I'm having trouble getting my code to work on a production server that is running PHP version 5.2.17. My test machine is running version 5.3.0 and the code works just fine. I do not have the ability to upgrade the version of PHP on the production machine. Here is part of my code. If we can fix this, I can fix the other switch cases: //this code adds the item to the cart and creates an array and session variable for the cart. The array is multidimensional (item id1 => quantity, item id2 => quantity, item id3 => quantity and so on...). if (isset($_GET["action"])) { $action = $_GET["action"]; $id = $_GET["id"] ; $q = $_GET["quantity"]; $cart = array(); switch ($action) { case "add": if ($_SESSION["cart"]) { $cart = $_SESSION["cart"]; if (array_key_exists($id,$cart)) { $cart[$id] = $cart[$id] + $q; } else { $cart[$id] = $q; } } else { $cart[$id] = $q; } $_SESSION["cart"] = $cart; break; } } //this code displays the cart array if ($_SESSION["cart"]) { $cart = $_SESSION["cart"]; foreach($cart as $key => $value) { $runQ1 = mysql_query("SELECT * FROM products WHERE id='$key'") or die(mysql_error()); $results = mysql_fetch_array($runQ1); print "<table><tr><td>$results[1]</td><td>$results[2]</td><td>$results[3]</td><td>$results[4]</td></tr></table>"; } } else { print "<table><tr><td>There are no items in your shopping cart.</td></tr></table>"; } The cart session variable is being set but it is only holding one item at a time. If I add a second item to the cart, the 1st item disappears and only the second one is present in the session variable and the table. I'm not sure if it is a session problem or an array problem. Please help before I lose all of my hair! I don't understand why this code works on 5.3.0 and not 5.2.17... Thanks in advance! -Isaac Hi all, But of a PHP newbie so treat me nice but this one is driving me nuts I have the exact same login.php file running on two different servers and they have slightly different versions of PHP installed as follows: 1. PHP Version 5.0.4 - version http://www.trafficpaymaster.com/tpm/phpversion.php 2. PHP Version 5.2.15 - version http://www.dentistsinflorida.org/tpm/phpversion.php The login works fine on the first server from he http://www.trafficpaymaster.com/tpm/login.php Email: test@test.com Pwd: test But try it on the second server he http://www.dentistsinflorida.org/tpm/login.php Using the same email and password (which is correct) it just loops round not letting the user into the main script at index.php Question: Why? What have I got wrong for that later version of PHP? Many thanks guys. Code: [Select] <?php $ACCEPT_FILE['home'] = 'home.html'; $ACCEPT_FILE['general'] = 'general.html'; $ACCEPT_FILE['attorneys'] = 'attorneys.html'; $ACCEPT_FILE['contact'] = 'contact.html'; $ACCEPT_FILE['login'] = 'login.html'; $pagename = $ACCEPT_FILE[$id]; if (!isset($pagename)) $pagename = "home.html"; // default file include( $pagename ); ?> the url looks like: www.yoursite.com/index.php?id=general Ever since i think like php 5 came out i am unnable to load pages it just defaults to the home.html no matter what variable is defined. any ideas or help would be appreciated. Its almost like its not defining the pagename variable until the bottom where $pagename = "home.html". ive been looking at it and reading the manuals for hours and figured its time to make a post. thanks. This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=316223.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333604.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=342757.0 This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=314220.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333306.0 This topic has been moved to Other. http://www.phpfreaks.com/forums/index.php?topic=327155.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=342166.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=346771.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=358574.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=359169.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=345904.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319172.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=316616.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=351058.0 |