note 47453 rejected from function.pg-fetch-row by sean
| From: | sean@php.net | Date: | Wed, 17 Nov 2004 04:00:23 +0000 |
| Subject: | note 47453 rejected from function.pg-fetch-row by sean | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-80619@lists.php.net to get a copy of this message | ||
Note Submitter: azornoz at yahoo dot es
----
A script that works ok with mysql is annoying me while changing it to pgsql:
1.- This does not work:
while ($var = pg_fetch_row($result))
{ $multi_array[$i][] = $var[0]; }
The index $i is because of I use it inside a for loop.
2.- Could somebody post here why this function is not working:
function DoArray($result,$pg_num_rows($result),$l,$multiarray) {
for ($k=0; $k < pg_num_rows($result); $k++) {
$row = pg_fetch_row($result);
for ($j=0; $j < count($row); $j++) {
$multiarray[$l][]= $row[$j] ;
}
}
}
Note that this is a try to write less code lines, and is exactly the same but trying to use a
function than the post inmediately before.
I have to repeat the code to make the multiarray thang after each different query. ¿ugly?