I have a problem in my PHP script that uses PostgreSQL for fetching and storing data.
Currently I am using the following code:
$q = "SELECT id FROM playlisty WHERE id_profilu=1;";
$r = pg_query($q);
$arr = pg_fetch_all($r);
echo '<pre>'; var_dump($arr); echo'</pre>';
The output generated by the above code snippet:
array(4) {
[0]=>
array(1) {
["id"]=>
string(4) "2014"
}
[1]=>
array(1) {
["id"]=>
string(4) "1549"
}
[2]=>
array(1) {
["id"]=>
string(4) "1965"
}
[3]=>
array(1) {
["id"]=>
string(4) "2047"
}
}
However, I would prefer if the output looked something like the following: 2014, 1549, 1965, 2047
(i.e. a simple array of id
-s of certain playlists).
I also tried using implode (to no anvil), and got Array,Array,Array,Array
as a reply.