English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP odbc_fetch_object() function usage and example

PHP ODBC Reference Manual

 The odbc_fetch_object() function retrieves the result row as an object.

Syntax

object odbc_fetch_object ( resource $result[, int $rownumber] )

Definition and usage

It is used to obtain the result as an object.

Return value

It returns an object or sends a message because there are no more rows.

Parameter

NumberParameters and descriptions
1

result

It contains the result resource from odbc_exec()

2

rownumber

We can choose the number of rows to retrieve

Example

Try the following example

<?php
   $input_ID = odbc_connect($db_name, $username, $password) or die(odbc_error_msg());
   $sql = "SELECT * FROM TABLE";
   $result = odbc_exec($input_ID, $sql);
   
   while ($rows = odbc_fetch_object($result)) {
      print $rows->COLUMNNAME;
   }
   
   odbc_close($input_ID); 
?>

PHP ODBC Reference Manual