i need to show the array values separate

$ids = array(12,13,14);
$ids1 = explode(",", $ids);
echo $ids1;

if i run this it shows array

Member Avatar for diafol
$ids = array(12,13,14);
foreach($ids as $id) echo $id;

No need to explode. explode() cuts a string into an array. Or...

$ids = array(12,13,14);
echo $ids[0];
echo $ids[1];
echo $ids[02];

thanks it works.and one more question if i want to upload array string values into single field how..
i used to upload like

$cityid = trim(ucwords(strtolower(mysql_real_escape_string($_POST['city']))));
            $num=count($_POST["place"]);
            /*foreach($_POST["place"] as $i=>$value) 
            {
                $value=$_POST["place"][$i];*/
                $ids = array();
                foreach($_POST['place'] as $val)
                {
                $ids[] = (int) $val;
                }
                $ids = implode(',', $ids);
                $sql3 = mysql_query("INSERT INTO `city_place`(`state_id`,`city_id`,`spaid`) VALUES ('$cityid','$ids',$lid)");

instead of id i want to stores string

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.