Dylan12 Dylan12 - 8 months ago 41
SQL Question

How to just get php array values

I want to insert an array into my db but I just want the values.

Right now it's giving me all of this

a:1:{i:0;s:38:"ARRAY VALUE";}

I just want the part "ARRAY VALUE" to insert into db.

Thank you


Hope this helps, I assume you want to save only array values not keys in database

    //I assume your array is like this 
    $array = array('a'=>20,'b'=>40,'c'=>60);
    //get array values
    $newArray = array_values($array);
    $arrToSave = serialize($newArray);

and while retrieving from database you need to use 
$array = unserialize('Retrieved field name');