Extracting varable number of elements in a query to named arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a SELECT query with a variable number of fields being included.  When
I come to extract them I get the wrong result with the following type of
code as it does not 'accordian down' the list of variables - $a $b etc -
which I equate to the named array I am trying to extract:

while(list($a, $b, $c, $d, $e, $f, $g, $h, $i, $j, $k, $l, $m, $n, $o, $p,
$q, $r)=mysql_fetch_array($result)) {
  $erefs[$z]=$a;
  $owners[$z]=$b;
  $addresss[$z]=$c;
  $contacts[$z]=$d;
....

Eg if I don't look for 'owners' in the query I end up with $b being the
addresses so that $addresss[$z]=$c; is a mismatch.  Is there an entirely
more adaptable way to extract the result into pre-defined array names with a
variable number of fields in the query?

Thanks,

John

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux