Jump to content

rochellecanale

New Members
  • Posts

    1
  • Joined

  • Last visited

rochellecanale's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello guys i have a problem. All i want is to pass my information coming from my multidimensional array. I try to create a function named r_implode that extract array into string but i dont know how to put it in the database. here's my code hope you can help me. //get array information $products = unserialize($this->session->userdata('product_list')); //print array information, works well foreach($products as $element => $inner_array){ echo "<strong>Product ID: ".$element."</strong><br>"; foreach($inner_array as $items){ echo $items."<br>"; } } //HOw CAN I PASS THE ARRAY INFORMATION TO MY DATABASE? //extract array into string works well function r_implode( $glue, $pieces ){ foreach( $pieces as $r_pieces ){ if( is_array( $r_pieces )){ $retVal[] = r_implode( $glue, $r_pieces ); }else{ $retVal[] = $r_pieces; } } return implode( $glue, $retVal ); } echo r_implode(',',$products)."\n"; example of my array layout: Product ID: 2 2 NOKIA 5110 Cellphone 500.00 1 500 NOKI2012-84353 Product ID: 3 3 HP IPAQ RW6828 Cellphone 1500.00 1 1500 HP I2012-08386
×
×
  • 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.