php obdc_fetch_array help please?
|
demo 22 Dec 2008 09:43am 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? |
Answers
|
demo 22 Dec 2008 10:02am 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 |
Related
Submit Answer
You must be logged in to post an answer. Please Login or Register.
Powered by phpMyAnswers.