Jump to content

FETNU

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

FETNU's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Are all the div's on the same page? If so, does your example reflect the naming convention you use? If so... then I would run through a for loop on your entire page. I did not test this code at all, but maybe use it more as pseudo code to help give you an idea... function determineNews() { var Id = 1; var newsDiv = 'news' + Id; for (i=0; i<document.forms[0].length; i++) { if (document.getElementById(newsDiv).innerHTML != "") { setHeight(document.getElementById(newsDiv)); Id = Id + 1; } } } Would something like that work for you?
  2. You know, I thought about that, but I wasn't sure if that would be OK to do. Would you then just do a rollback if something failed?
  3. Before I dive into the coding for the next part of my application, I'm trying to figure out the best way to accomplish this. Here's the history: When opening the page, I grab ALL the items from the ITEM_SELECTION table (mysql database) by item_category (for example baby clothes, toys, bath products, etc..). I then display all those items on the page (so this page would contain all baby clothes).... The user has the option to scroll down the page and change the quantities to whatever numeric values they want. Now, the part that I'm trying to figure out... When the user clicks the "Update Quantities" button I need to Add, update or delete these items to my SHOPPING_BASKET_TEMP table. So, I need to see if the item already exists in the temp table, if so, I either need to update the quantity or delete the row (depending on the value the user entered). If it does not exist, then I need to insert the record into the table. Each page could have up to 20 items on it, so I'm thinking I need to use arrays???? Any recommendations??? I'm fairly new to PHP and mySQL, but I've taught myself everything up to this point and I have pretty good e-commerce application going so far. At this point, I'm mainly looking for a high level explanation to achieve this. Any help over this next hump is greatly appreciated. Thanks! FETNU
  4. I ended up doing it like this: $query = "SELECT a.* , COALESCE(b.ITEM_QTY,0) as ITEM_QTY FROM ITEM_SELECTION a LEFT OUTER JOIN SHOPPING_BASKET_TEMP b ON b.ITEM_ID = a.ITEM_ID AND b.BASKET_SESSION_ID = '$sid' WHERE a.ITEM_CATEGORY in ('TOYS') AND a.ACTIVE_IND = 'Y' ORDER BY a.ITEM_NAME, a.ITEM_SIZE ASC"; $result = mysql_query($query); Thanks for the responses!
  5. Hey Guys (and girls), I just started learning PHP and MySQL and I've used this site for so much help! Now, I finally came to a point where I needed to ask a question. I'm creating a web application where I have a master table (ITEM_DETAILS) that contains EVERY item and all the necessary data associated with that item (item_id, item_price, category, cost, size, etc...). I have another table (SHOPPING_BASKET_TEMP) that stores the items that have been added to the shopping cart. This table contains the item_id, item_qty, category, price, etc... What I need to do is... when the page opens, select ALL the items from ITEM_DETAILS for a certain category. Second, I need to look at SHOPPING_BASKET_TEMP and if the user has that item in their cart (based on their session_id, item_category and item_id), then I need to select the item_qty for that item, else, I need to return a item_qty of 0. I've tried joins, unions, various selects and I've had absolutely NO luck. Can somebody PLEASE help to send me in the right direction? Any help would be GREATLY appreciated! ~FETNU
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.