定义和用法

odbc_errormsg – 获取最后一条错误消息

语法

odbc_errormsg ( [ resource $connection_id ] )

返回包含最后一个odbc错误消息的字符串,如果没有错误则返回空字符串。

参数

参数 必需的 描述
connection_id odbc 连接标识符,详见 。

返回值

如果指定了connection_id,则返回该连接的最后状态,否则返回任何连接的最后状态。 仅当上一个odbc查询失败(即odbc_exec()返回false)时,此函数才返回有意义的值。

// you must set the connection first
 if (odbc_errormsg())
 {
       echo odbc_errormsgmsg($conn);
 }
 // if you want to show the perfect error message
 // then format it using string functions.

相关函数

 – 获取最后的错误代码 – 准备并执行一条sql语句