Jump to content
Larry Ullman's Book Forums


  • Posts

  • Joined

  • Last visited

Posts posted by daviddawn

  1. HI Cynthie,


    what software are you using to open the zip download and what operating system, winrar for windows operating system is a good program to use.


    once downloaded the code will be in the file named 'sql.sql' as its a sql file you can simply import it into a database using phpmyadmin facilitating the process opposed to copy and pasting each manually.

  2. but that's only if i store the $_SESSION variable into a column into a table in the database, for example, if i had a table called "cartdata" could i not do this ?


    INSERT INTO cartdata (customer_id, user_session_id, sku, quantity) VALUES ($_SESSION['cid'], $_SESSION['uid'], $_GET['product_sku'], 1)


    before i run the query, i would check to see if customer_id is set, if not, i will use user_session_id, however the table will encounter null values in some columns due to this, so i was thinking of making a seperate table for guests. 


    what your thoughts?

  3. HI Larry,


    what i am trying to achieve is a common approach of allowing a user to checkout without being a registered member as the example does, however i want to implement a registration system in the site, and know the best way of holding data in a cookie or session and knowing the best time to switch the data over from the cookie to the session.


    Should i start the session on every page and when a user logs in just add user_id to the session and delete it when they log out? or use cookies only until a user logs in or a non-user reaches the checkout page ?


    one more thing, how can i setup an area where  a non user could check or track their order?


    thank you!

  4. HI Larry,


    in example 2, cookies are used when a user first visits the site, however the session starts at checkout, would it not be best to use cookies and sessions only to avoid superfluous build up of frivolous data in the database? if i were to have 2 tables, USERS for my registered users and CUSTOMERS data for any customer to make a purchase as a guest and just tie that data to either a user id if the user is registered with a user id set in session, or customer id if the user is not registered and is only checking out as a guest, this way if the user some how managed to alter the session id inside the cookie on their browser, the worst thing that could happen would be that no items would be set in the cart but a new session would start with the id the user altered. did you get all that ? hope so



  5. the code you should be using is on page 111, in which a select tag is created, and then a query is made to the database to retrieve all categories, the query results are then transfered into the array ( select name="category[]" ) which will look like 0 ->hats 1 ->gloves 2 -> socks etc... the select tag prints these categories, in your case it seems there is no items in the categories array, somewhere in your code add trigger_error(database_connection_variable);  then look for the categories array to check if its empty.

  6. HI All,


    Im a little confused as to the best way to approach the dealings with sessions when checking out, logging in, and logging out, in example 1, larry starts the session in the config which is included in every page to help follow the user, in example 2 however, only cookkies are used until the checkout process, now what i am wanting to do is implement user registration on ecommerce which allows users to login and complete checkout but also give the option to checkout as a guest, without the user being registered,


    my question is, whats the best way to track users? as logging in starts the session and logging out destroys the session, so if a user logs out will all items in cart be empty ?


    im bascially trying to implement both examples in the book, any help or input would be much appreciated.


    thanks guys! :)

  7. HI All,


    been stuck on this for some time now, I rearranged my database by replacing the "product_type" and "product_id" columns for a "sku" column and altered the stored procedure to accept the "sku" and "uid" arguments, I also corrected the scripts to send these arguments to the stored procedures respectivley.


    however rather than a new seperate product being added it just adds another to the quantity with an increment of 1, i can see all the different sku numbers for different products in the url, but not sure why the stored procedure is not accepting this!


    any help would be appreciated!


    many thanks :@)

  8. HI People,


    if i were to show customers details of a product selected from a catalog, would i carry variables from the previous query used to retrieve all products from the database to show on the catalog, or would i simply need to create a new query to retrieve the details for that product?


    Little confused as most of the details i need, name, image and description were already retrieved for the catalog however i do need to retrieve some additional info for the product as in sizes and colors, but unsure of best way for doing so.


    many thanks

  • Create New...