note 47453 added to function.pg-fetch-row

From: Date: Tue, 16 Nov 2004 23:10:36 +0000
Subject: note 47453 added to function.pg-fetch-row
Groups: php.notes 
Request: Send a blank email to php-notes+get-80618@lists.php.net to get a copy of this message
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? ---- Manual Page -- http://www.php.net/manual/en/function.pg-fetch-row.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47453 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47453&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47453&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80618) next »