Jump to content
Larry Ullman's Book Forums


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About SaintClair

  • Rank
  1. Thank you for your help Larry, I did not think about the column's size limit while troubleshooting earlier. Hopefully this paper trail will help someone else with a similar issue.
  2. Ok Larry/guys I got it! I dropped the add_to_cart stored proc and recreated it with an increased character acceptance from 32 to 100 for the uid. So the problem was with the stored proc character limit. I already updated the cart table previously to reflect the same : DELIMITER $$ CREATE PROCEDURE add_to_cart (uid CHAR(100), type VARCHAR(6), pid MEDIUMINT, qty TINYINT) BEGIN DECLARE cid INT; SELECT id INTO cid FROM carts WHERE user_session_id=uid AND product_type=type AND product_id=pid; IF cid > 0 THEN UPDATE carts SET quantity=quantity+qty, date_modified=NOW() WHERE id=cid; ELSE IN
  3. Just dropped and recreated the get shopping cart contents stored proc. And that didn't help, thought maybe it was corrupted some way. I cleared all cache sense the beginning of time on laptop and tried to add to cart and it still isn't adding the item to the cart. But of course it did give me a different UID this time: f8f221f37c9901c9c53d2dd605f19b72. Any ideas anyone?
  4. Ok for #3 for the column's size restriction after changing it to 100; it still gave me the emptycart.html view and not the cart.html view. And select * from carts is still empty.
  5. 1. Thank you Larry. Ah okay, yes I am. To check the session id would I have to place this in the cart.php file?: session_start(); echo session_id(); 2. And have you confirmed what session value is being stored in the database? This would be in the cart table? Nothing is getting populated in the cart table 3. You may need to check the column's size restriction, too - Ok it was char32 I changed it to char 100. Let me try this again and see what it does.
  6. Thank you Larry! I didn't think about this until this caused me to look at my earlier post. The post I posted at 2:44pm yesterday has the session id of: SESSION] => 4fbc2b4445cceae1478d7de712f5659c But the session id after closing out the tab from yesterday and starting a new session this morning, they appear to have the same session id. They can't be right? And shouldn't be stored in the cart table? This is from this morning: Results from echo'ing out these variables used in the add_to_cart stored proc: 4fbc2b4445cceae1478d7de712f5659c
  7. Ok so when looking at the stored proc for "get_shopping_cart_contents" I see that it is joining where "c.user_session_id=uid". I checked in the carts table and nothing is populated with any user_session_id values.
  8. Thanks much for this troubleshooting step JohnD! Ok I tried it, and it did return back a return count of 0 for the rows. So the disconnect is between me clicking the Add to Cart button on the Kona Decaf item and the CALL to the "CALL add_to_cart('$uid', '$sp_type', $pid, 1)"); So I echo'd out the variables used in the add_to_cart stored proc and they returned back correctly(see below). It can't be the level of security of my cookies, I don't believe? What else could I try? What was echo'd out. $r = mysqli_query($dbc, "CALL get_shopping_cart_contents('$uid')"); $row_count = mysqli_num_r
  9. Okay I did some more troubleshooting and echo'ed out the $uid and I see the SESSION number so it is set. So it can't be the COOKIE SESSION. Any ideas, anyone? [_COOKIE] => Array ( [sESSION] => 4fbc2b4445cceae1478d7de712f5659c )
  10. Hi, I've been troubleshooting the Creating the Views section in Chapter 9 and I can't seem to figure out why it keeps displaying the emptycart.html after I click add to Cart for the Kona Decaf item? It checks if the rows returned back from the Stored Proc is greater than zero. It should be as I added the item but yet it keeps showing the HTML for emptycart.html and not the cart.html file. To troubleshoot to see if the "if else" and the cart.html is working I changed the code to if the rows returned are <=0 and it finally showed my cart.html. But why doesn't it work when it is $r >
  11. Sorry I got it, I left off the DELIMITER at the beginning and the end. This is resolved.
  12. The first stored procedure below worked correctly, so my phpMYADMIN is up to date enough to create stored procedures: "DELIMITER $$ CREATE PROCEDURE select_categories (type VARCHAR(6)) BEGIN IF type = 'coffee' THEN SELECT * FROM general_coffees ORDER by category; ELSEIF type = 'other' THEN SELECT * FROM non_coffee_categories ORDER by category; END IF; END$$
  13. Hi, I hope everyone is well. When running the stored procedure for creating select_products below in phpMYADMIN I get the error: "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 10". When I look at the line, the syntax seems to be correct. Line 10 is where "ORDER BY name ASC;" lies, and where the error message is stating the problem resides. Can anyone point me in the right direction? Many Thanks, CREATE PROCEDURE select_products(type VARCHAR(6), cat TINYINT) BEGI
  • Create New...