odbc_error() questions
- From: "Wescotte" <wescotte@xxxxxxxxxxxxx>
- Date: 17 Jan 2006 15:54:24 -0800
Reading the docs I noticed the following appended by a user
"If you use an argument, make sure its the CONNECTION_ID and not the
RESULT_ID.
Testing the result can return a null string or sometimes a garbage
string."
I'm getting very strange results when using odbc_error($connect) where
it's almost always true and when I follow up with
odbc_errormsg($connect); I get junk results. However if I leave out a
connection id it seems to function correctly (that is never returns
true)
Any ideas why I'm sometimes getting garbage back?
Here is a little sample I wrote with it's output
<?php
include "c:/out_of_httpd_scope_vars.php";
$connect = odbc_connect ("AS400", $USERNAME,$PASSWORD);
odbc_autocommit($connect, FALSE);
if ($connect == false)
printf("Problem connecting to the database");
for ($i = 1; $i < 1000; $i++) {
$query = "LOCK TABLE WEBSYS.FRTBNUM IN EXCLUSIVE MODE";
$result = odbc_exec($connect, $query);
if (odbc_error($connect)) {
echo "ERROR! Unable to lock table SQL ($query) failed errormsg = (" .
odbc_errormsg($connect) . ") <BR>";
}
odbc_rollback($connect);
}
odbc_close($connect);
?>
Output is 1000x of
ERROR! Unable to lock table SQL (LOCK TABLE WEBSYS.FRTBNUM IN EXCLUSIVE
MODE) failed errormsg = ()
However when I don't put this in a loop and just execute it a single
time sometimes it outputs the error message and sometimes it doesn't.
So do I just drop the $connect from odbc_error()?
.
- Prev by Date: Re: CGI to ISAPI, now no MySQLi
- Next by Date: Re: EXEC() Runs process in background
- Previous by thread: EXEC() Runs process in background
- Next by thread: Detecting the servers OS
- Index(es):
Relevant Pages
|