Jump to content
Larry Ullman's Book Forums

armlocker

Members
  • Content Count

    83
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by armlocker

  1. ... woops - my bad ... here's what is now showing after echo $query; =============================================================== QUESTION 1 How many bytes are used to represent the primitive...? Choose the right answer: Resource id #42 4 8 1 correct answer
  2. Hello again Yoda of PHP I have echoed the $sql; under the select query above and now I get the : Notice: Undefined variable: sql in C:\xampp\htdocs\game\index.php on line 16 my database (questions) structure is simple. here are the coloumns questions_record_number question_id question answer option1 option2 option3 option4 subject NOTHING IS WORKING AT THE MOMENT - AND HERES WHATS SHOWING =============================================================== QUESTION 1 How many bytes are used to represent the primitive...? Choose the right answer: Notice: Undefine
  3. Hi there, just trying to get some practice in by creating a simple php game - can someone tell me where am I going wrong please: Thanks in advance <?php $con = mysql_connect('localhost', 'root', ''); mysql_select_db("krish"); ?> QUESTION 1<br><br> How many bytes are used to represent the primitive...? <br><br> Choose the right answer:<br><br> <?php $query = mysql_query("SELECT * FROM questions WHERE question_id = 'Q1'"); while ($row = mysql_fetch_assoc($query)) { echo $row['option1'] . '<input type="radio" name="option_1" val
  4. .... you see these parts in the script; they are meant to bring the user back to checkout.php after they press the pay button. <br /><br />'.$checkout_button.'</p>'; and this part: <input type="hidden" name="notify_url" Value="http://www.wolfcut.co.uk/checkout.php" /> I was trying this; to link the checkout button; which didn't work either: <br /><br /><a href="checkout.php"'.$checkout_button.'</a></p>';
  5. Hi HartleySan Yep, I've just spotted that typo too, should be: session_id($cid); the view_cart.php with the added paypal button looks like this - which is not linking to the checkout.php after the customer presses the buy button: echo "\t<tr> <td align=\"left\">{$row['artist']}</td> <td align=\"left\">{$row['print_name']}</td> <td align=\"right\">£{$_SESSION['cart'][$row['print_id']]['price']}</td> <td align=\"center\"><input type=\"text\" size=\"3\" name=\"qty[{$row['print_id']}]\" value=\"{$_SESSION['cart'][$row['print_id'
  6. Hi All. I can't get a redirect back to the "checkout.php" in chapter 19. I am using a personalised paypal button. Firstly; are these lines correct in checkout.php? // customer is logged in and this page has access to the customer's ID: session_id)£id); // this page receives the order total: $subtotal = $_SESSION['cart'][$row['print_id']]['quantity'] * $_SESSION['cart'][$row['print_id']]['price']; Secondly; heres the code from view_cart.php with my paypal button, but the problem is that it's not directing it back to checkout.php (above code may be incorrect?) <!--- this
  7. Hi All How do I add shipping_costs to view_cart.php. It's getting more complicated the more I think about real life situations because shipping costs is determined by weight. The column 'shipping_cost' already added to database, so do I plus (+) the shipping cost to quantity, or times (x) shipping cost by quantity? Can someone show me both ways as it probably depends on the situation in real life. Here's the view_cart.php section that needs the extra code: // Calculate the total and sub-totals. $subtotal = $_SESSION['cart'][$row['print_id']]['quantity'] * $_SESSION['cart'][$r
  8. Thank guys. I managed to figure this out: here's what I ended up doing which worked: echo (is_null($row['size'])) ? '(No size information available)' : $row['size']; echo "<br />£{$row['price']} "; if($row['in_stock']=='no') echo "<br>Out of stock. Email us to let us know and we will do everything we can to get it for you."; else echo "<a href=\"add_cart.php?pid=$pid\">Add to Cart</a>"; echo "<br >"; echo "Items in stock: ".$row['stock_available']; echo "</div><br />";
  9. How do I add " In Stock" to in the view_cart.php on page 642? Adding the "in stock" field in MySQL is easy enough, but how do you add the link in the shopping car?
  10. Cheers larey, all sorted. All I had to do was place the database connection at the beginning of the scripts
  11. Hello I keep getting "Your cart is currently empty." regardless of what is added to the cart. Here are two scripts: add_cart.php and view_cart.php view_cart.php <?php # Script 19.10 - view_cart.php // This page displays the contents of the shopping cart. // This page also lets the user update the contents of the cart. // Set the page title and include the HTML header: $page_title = 'View Your Shopping Cart'; include ('header.html'); // Check if the form has been submitted (to update the cart): if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Change any quantities: foreach (
  12. .... I think I do.... it's this segment of code that is removing items from cart and wishlist. $r = mysqli_query($dbc, "DELETE FROM carts WHERE user_session_id='$uid' AND product_type='$sp_type' AND product_id=$pid");
  13. ... I know what this looks like Larry, it's turning into a debugging lesson (lol) to debug I've done this to debug that line of code. <?php ini_set('display_errors', 'On'); error_reporting(E_ALL); echo '<pre>'; print_r( // For debugging purposes: if (!$r) echo mysqli_error($dbc); } elseif (isset ($sp_type, $pid, $_GET['action']) && ($_GET['action'] == 'remove') ) { // Remove it from the cart. $r = mysqli_query($dbc, "DELETE FROM carts WHERE user_session_id='$uid' AND product_type='$sp_type' AND product_id=$pid"); } elseif (isset ($sp_type, $pid, $_GET['action'],
  14. Hail L-U!! I can confirm that cart.php "Move to wishlist" link works fine "Remove from cart" link doesn't works at all wishlist.php "Move to cart" link works fine "Remove from wishlist" link doesn't works at all Is this what you wanted me to confirm?
  15. Happy Easter Larry. I am still encountering problems with line 1 after trying various combinations, such as removing the quotation wraps changing the quotation to single quotes removing or changing the quotation of the variables, so they don't clash with the opening quotes ... still no joy. Could it be something to do with this section of the code? // Remove it from the wish list: $r = mysqli_query($dbc, "CALL remove_from_wish_list('$uid', '$sp_type', $pid)"); } elseif (isset($_POST['quantity'])) { // Update quantities in the cart. // Loop through each item: foreach ($_POS
  16. .... I have put the inserted code from your blog (http://www.larryullm...l-3-chapter-10/) to replace stored procedures, and put the 'Session ID' through SQL on PHPMYADMIN and have come up with the following error on line one. ErrorSQL query: "SELECT CONCAT('O', ncp.id) AS sku, c.quantity, ncc.category, ncp.name, ncp.price, ncp.stock, sales.price AS sale_price FROM carts AS c INNER JOIN non_coffee_products AS ncp ON c.product_id=ncp.id INNER JOIN non_coffee_categories AS ncc ON ncc.id=ncp.non_coffee_category_id LEFT OUTER JOIN sales ON (sales.product_id=ncp.id AND sales.product_type='oth
  17. Hello All. The link "Remove from wishlist", on the Wishlist page is not working. i.e, it's not removing item from the Wishlist. It could be the wishlist.html or the wishlist.php (I'm not sure). Here's the code for both. Thank you in advance!! wishlist.html (php part) <?php // Fetch each item: while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { $price = get_just_price($row['price'], $row['sale_price']); $subtotal = $price * $row['quantity']; echo '<tr> <td>' . $row['category'] . '::' . $row['name'] . '</td> <td align="center"><input type="te
  18. Thanks Larry. By the way, the PHP and MySQL for Dynamic Web Sites 4th edition was a really good guide for beginners. I went through the exercises and found it really easy set up the art ecommerce in the last chapter. For my future reference, how did you become so good at coding? I hand copied many chapters of the code from the PHP book and found that really useful in understanding learned a hell of lot, but I sure as hell couldn't write my own code or even know how to structure a simple script. (maybe I'm not trying hard enough). So, what tips exercises can you give me?
  19. Hi Larry - good to speaking to you again. Yes, sorry, what I meant was an error message like this. I think I will purchase the SSL because I want it to be as realistic as possible This webpage is not available Google Chrome could not load the webpage because http took too long to respond. The website may be down, or you may be experiencing issues with your Internet connection. Here are some suggestions:Reload this webpage later. Check your Internet connection. Restart any router, modem, or other network devices you may be using. Add Google Chrome as a permitted program in your fire
  20. Hi there Am I right in saying that without the SSL being enabled, checkout.php, billing.php, and final.php will not work and will just show up as a blank screen? Thanks
  21. Hail Margaux - you did it! How in wonder did you spot that? I swear I went through the thing matching each and every parenthesis, closing bracket and single and double quotations....
  22. Hi guys. Finally at the end of Chapter 10. I have a problem with the wishlist.php. The cart.php works fine, and they are nearly the same. When I transfer stuff to the 'Wishlist', I get this error: Parse error: syntax error, unexpected $end in /hermes/waloraweb004/b1384/moo.laissezfairelondonco/wolfcut.co.uk/wishlist.php on line 110 I have been trying to locate the missing parenthesis error from beginning to end for half a day, so I guess its time to ask for help. I've made sure all the single and double quotations are as they should be, so I don't think its that. The script is
  23. Just a general novice question =: What does 'SKU' stand for in the database, where all the different types of coffee are inserted? Thanks - I just need to know for knowing sake
  24. ....right you are. I didn't find it because the pages after 213 showed figure 8.12 to 8.19 at end of chapter 8.
×
×
  • Create New...