note 40951 added to function.odbc-fetch-array

From: Date: Wed, 24 Mar 2004 15:46:04 +0000
Subject: note 40951 added to function.odbc-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-67106@lists.php.net to get a copy of this message
This is a quick and dirty way to accomplish the same thing: <? while(odbc_fetch_row($result)) { $var1 = odbc_result($result, "NAMEOFFIELD1"); $var2 = odbc_result($result, "NAMEOFFIELD2"); ..... //as many vars as you have fields with data to capture $array_of_results[] = compact('var1', 'var2','var3', etc, etc) } ?> Just turn each returned row's data into variables then use the compact(). Turns each variable name into a key and the vars value into the array value. Makes a wonderful 2d array that you can walk easily and still use key values to get at data. ---- Manual Page -- http://www.php.net/manual/en/function.odbc-fetch-array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40951 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40951&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40951&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67106) next »