Jump to content

Variable number of cols for a record


azunoman

Recommended Posts

Please excuse my rather novice question but I am at a point where I need the freaks direction on how to proceed.

 

Have a cart...the cart has a productid with a variable number of accessories selected by the customer.  Each of the fields required to define an accessory are the same.  There can be 1-30 accessories...

 

Looking for a the best approach in storing the variable number or accessories without having to have a unique mysql column name?...jajajaja...I find it somehow tacky (but will do it) to hard code a max number the col names in mysql for acc0,acc1,...as each accx has it's own information which would have to have a unique name also. 

 

I am considering just storing my cart array in a text field but I am somewhat worried about (un)serilization not working properly especially as my data can be in multiple languages.

 

Thanks in advance you freaks!

 

Please note in cart array that each acc is associated to a group but only the accID is really needed for the file.  Nor does this cart show price etc.

 

Here is a typical cart:

    [cart] => Array
        (
            [PCOLOR] => Array
                (
                    [0] => 73
                )

            [TIRE] => Array
                (
                    [0] => 49
                )

            [CHRG] => Array
                (
                    [0] => 43
                )

            [bATT] => Array
                (
                    [0] => 39
                )

            [sEAT] => Array
                (
                    [0] => 23
                )

            [sEAC] => Array
                (
                    [0] => 68
                )

            [ARMPADOPT] => Array
                (
                    [0] => 66
                )

            [ARMS] => Array
                (
                    [0] => 13
                )

            [DCTL] => Array
                (
                    [0] => 4
                )

            [bASK] => Array
                (
                    [0] => 67
                    [1] => 61
                    [2] => 37
                    [3] => 52
                    [4] => 9
                )

            [OXYG] => Array
                (
                    [0] => 47
                )

            [PELV] => Array
                (
                    [0] => 55
                )

            [MISC] => Array
                (
                    [0] => 2
                    [1] => 28
                    [2] => 57
                    [3] => 62
                    [4] => 33
                    [5] => 45
                    [6] => 63
                    [7] => 1
                    [8] => 48
                    [9] => 46
                )

            [ProdID] => 49
            [CartTime] => 1223587286
            [ProdQty] => 1

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.