php obdc_fetch_array help please?

  • Thread starter Thread starter maito
  • Start date Start date
M

maito

Guest
need to out put the contents using OBDC.
when using mysql I would do the following

PHP Code:
while($row=mysql_fetch_array($rs))
{
echo "<tr><td>";
echo $row[ 'date' ];
echo"</td><td>";
echo $row['EventName'];
echo"</td><td>";
echo $row['webAddress'];
echo "</td></tr>";



}

when i try it using OBDC it says I am calling a undefined function
How then would I do virtually this same thing using OBDC?
 
I found the function submitted by jezndiatyahoodotcodotuk to be very helpful. I'm using PHP 5.2.5 and this function isn't defined, so it may depend on the ODBC driver being used.

The only problem with the solution already posted is that the return values don't match the ones specified by the documentation. I made the following modification so that the function will work the same whether it exists internally or not:

<?php
if (!function_exists('odbc_fetch_array')) {
function odbc_fetch_array($result, $rownumber=null) {
$array = array();
if (!($cols = odbc_fetch_into($result, $result_array, $rownumber))) {
return false;
}
for ($i = 1; $i <= $cols; $i++) {
$array[odbc_field_name($result, $i)] = $result_array[$i - 1];
}
return $array;
}
}

?>



or see this :
http://www.php.net/manual/en/function.odbc-fetch-array.php
 
I found the function submitted by jezndiatyahoodotcodotuk to be very helpful. I'm using PHP 5.2.5 and this function isn't defined, so it may depend on the ODBC driver being used.

The only problem with the solution already posted is that the return values don't match the ones specified by the documentation. I made the following modification so that the function will work the same whether it exists internally or not:

<?php
if (!function_exists('odbc_fetch_array')) {
function odbc_fetch_array($result, $rownumber=null) {
$array = array();
if (!($cols = odbc_fetch_into($result, $result_array, $rownumber))) {
return false;
}
for ($i = 1; $i <= $cols; $i++) {
$array[odbc_field_name($result, $i)] = $result_array[$i - 1];
}
return $array;
}
}

?>



or see this :
http://www.php.net/manual/en/function.odbc-fetch-array.php
 
Back
Top