• PHP Video Tutorials

PHP - Function Errormsg



Syntax

string odbc_errormsg ([ resource $connection_id ] )

Definition and Usage

It used to get the last error message

Return Values

It returns last state of that connection on success or else it returns last state of any connection on failure.

Parameters

Sr.No Parameters & Description
1

connection_id

It contains the information about connection id

Examples

Try out following example

<?php
   {
      $input_ID = odbc_connect("DSN","user_id","pass_id");
      $sql = "SELECT ProductName, UnitPrice FROM WrongTable";
      
      if (!$result = @odbc_exec($input_ID, $sql)) {
         echo "Query error! ODBC error: ", odbc_errormsg();
      } else {
         while (odbc_fetch_row($result)) {
            echo odbc_result($result, "ProductName"), "\n";
         }
      }
   }
?>
php_function_reference.htm
Advertisements