• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Store A Multi Dimensional Array In Mysql Database

#1
[eluser]rochellecanale[/eluser]
hey guys just want to ask how can i store a multidimensional array in mysql database. Right now i can view my array. Here's my code in viewing.

Code:
$products = unserialize($this->session->userdata('product_list'));

foreach($products as $element => $inner_array){
        echo "<strong>Product ID: ".$element."</strong><br>";
        foreach($inner_array as $items){
            echo $items."<br/>";
        }
    }

Now i want to put my information in the database.
My simple output is like this:

Product ID: 19 //id
19 //id
TEST PRODUCT 7 //name
N/A //description
5.00 //price
1 //qty
5 //total amount
TEST2012-64654 //code

Product ID: 20 //id
20 //id
TEST PRODUCT 8 //name
N/A //description
5.00 //price
1 //qty
5 //total amount
TEST2012-43672 //code

how can i store these values in my sales table?
It is layout like this.

ID | FKPROD_ID | NAME | DESC | PRICE | QTY | AMOUNT


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.