Home >> FAQs/Tutorials >> SQL Server FAQ

SQL Server FAQ - PHP ODBC - Returning Result Set Objects

By: FYIcenter.com

(Continued from previous topic...)

PHP ODBC - What Is a Result Set Object Returned by odbc_exec()?

A result set object is a logical representation of data rows returned by odbc_exec() function on SELECT statements. Every result set object has an internal pointer used to identify the current row in the result set. Once you get a result set object, you can use the following functions to retrieve detail information:

  • odbc_free_result($res) - Closes this result set object.
  • odbc_num_rows($res) - Returns the number rows in the result set.
  • odbc_num_fields($res) - Returns the number fields in the result set.
  • odbc_fetch_row($res) - Moving the internal pointer to the next row.
  • odbc_fetch_array($res) - Returns an array contains the next row indexed by filed names. The internal pointer is moved to the next row too.
  • odbc_fetch_object($res) - Returns an object representing the next row. The internal pointer is moved to the next row too.
  • odbc_field_len($res, $1) - Returns an array contains lengths of all fields in the last row returned.
  • odbc_field_name($res, $i) - Returns the name of the field of the specified index.
  • odbc_result($i) - Returns the value of the field specified by its position from the current row.
  • odbc_result($name) - Returns the value of the field specified by its name from the current row.

(Continued on next topic...)

  1. PHP ODBC - How To Create a New Table?
  2. PHP ODBC - How To Insert Data into an Existing Table?
  3. PHP ODBC - How To Insert Multiple Rows with a subquery?
  4. PHP ODBC - How To Get the Number of Affected Rows?
  5. PHP ODBC - What Is a Result Set Object Returned by odbc_exec()?
  6. PHP ODBC - How To Loop through Returning Rows?
  7. PHP ODBC - How To Update Existing Rows in a Table?
  8. PHP ODBC - How To Delete Existing Rows in a Table?
  9. PHP ODBC - How To Include Text Values in SQL Statements?
  10. PHP ODBC - How To Include Date and Time Values in SQL Statements?
  11. PHP ODBC - How To Display a Past Time in Days, Hours and Minutes?
  12. PHP ODBC - How To Perform Key Word Search in Tables?
  13. PHP ODBC - How To Query Multiple Tables Jointly?
  14. PHP ODBC - How To Create an Identity Column?

Related Articles:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...