note 83803 modified in function.odbc-fetch-row by danbrown

From: Date: Fri, 25 Jun 2010 13:41:36 +0000
Subject: note 83803 modified in function.odbc-fetch-row by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170420@lists.php.net to get a copy of this message
Here's my silly companion to odbc_fetch_row, odbc_fetch_column! It takes a SQL table and the Column's name to look for, and returns an array with all the items in that column. It can be easily changes to take the column's number instead of name, but I prefer it this way. <?php function odbc_fetch_column($my_rs,$col_name) { $tmpArray = array(); while (odbc_fetch_row($my_rs)) {array_push($tmpArray,odbc_result($my_rs,$col_name));} return $tmpArray; } ?> --was-- Here's my silly companion to odbc_fetch_row, odbc_fetch_column! It takes a SQL table and the Column's name to look for, and returns an array with all the items in that column. It can be easily changes to take the column's number instead of name, but I prefer it this way. function odbc_fetch_column($my_rs,$col_name) { $tmpArray = array(); while (odbc_fetch_row($my_rs)) {array_push($tmpArray,odbc_result($my_rs,$col_name));} return $tmpArray; } http://php.net/manual/en/function.odbc-fetch-row.php

« previous php.notes (#170420) next »