I first posted this in the javascript forum, but it turned to be a php problem. When I try to implode the $myarray I get an "Array to string conversion" error. If I change my array in the implode function to myarray2 it works. How can I get the implode function to work with myarray? I'm not sure why it doesn't work with that one, thanks.
Code:$x = 1; while($row = mysql_fetch_array($subcategory)) { $subid = $row['subid']; $subcat = $row['subcategory']; $myarray[$x] = array($subid, $subcat); $x = $x + 1; } print_r($myarray); $myarray2 = array('test', 'test2', 'test3'); print_r($myarray2); ?> <?php $test = implode(', ', $myarray); echo($test); ?>




Bookmarks