84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
I need to arrange the SQL results in PHP as follows:
if (!$result) { echo "An error occurred.\n"; exit; } while($array = pg_fetch_array($result)) { $list = $array['list']; } pg_free_result($result);
But only pedro is returned in the array.
pedro
You need pg_fetch_assoc() to get the returned associative array.
And you need to build an array to append the nodes:
$lists = []; while ($row = pg_fetch_assoc($result)) { $lists[] = $row['list']; }
Or if you just want to play around, you can use pg_fetch_all_columns().
https://www.php.net /manual/en/function.pg-fetch-all-columns.php
$lists = pg_fetch_all_columns($result, 0);
0 represents the first column in the row.
You need pg_fetch_assoc() to get the returned associative array.
And you need to build an array to append the nodes:
Or if you just want to play around, you can use pg_fetch_all_columns().
https://www.php.net /manual/en/function.pg-fetch-all-columns.php
0 represents the first column in the row.