Proplem Convert array to string in PHP -


i try converting array string php not work , show notice:

notice: array string conversion in c:\xampp\htdocs\test\test2.php on line 5 

something wrong? , code:

<?php       include("config/dbconnect_acc.php");      $query = mysql_query("select id users") or die(mysql_error());      while($row[]= mysql_fetch_array($query));      $data = implode(",",$row);      echo $data;     ?> 

when print_r($row) show result format:

array ( [0] => array ( [id] => 581 ) [1] => array ( [id] => 42325 ) [2] => array ( [id] => 21975 ) [3] => array ( [id] => 60327 ) [4] => array ( [id] => 113788 ) [5] => array ( [id] => 63282 ) [6] => array ( [id] => 85149 ) [7] => array ( [id] => 40737 ) [8] => array ( [id] => 28508 ) 

but want format:

(581,42325,21975,60327...) 

how should do? please me! all!

try this:

<?php      include("config/dbconnect_acc.php");       $query = mysql_query("select id users") or die(mysql_error());           $arr = array();           while($row= mysql_fetch_array($query))      {         $arr[] = $row['id'];       }       $ids = implode(",",$arr);      echo $ids;     ?> 

$arr[] = $row['id']; consider line.


Comments