We now have a youtube channel. Subscribe!

PHP | odbc_fetch_object() Function

PHP odbc_fetch_object() Function

Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP odbc_fetch_object() Function.

The odbc_fetch_object() function fetches a result as an object.


Following below is the syntax to use this function -

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

Parameter Details

Sr.NoParameters & Description


It contains result resources from odbc_exec()



we can choose optionally that which number of row to retrive

Return Value

This built-in PHP function returns an object on success or otherwise sends a message as there is no more rows.


Try out the following example below -

   $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;

Alright guys! This is where we are going to be rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the PHP odbc_fetch_row() Function.

Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.

Thanks for reading and bye for now.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain