odbc_error() questions



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()?

.



Relevant Pages

  • Re: Open a form at a specific record
    ... Allen Browne - Microsoft MVP. ... and I get error message Compile error: Expected: end of statement. ... Dim strWhere As String ...
    (microsoft.public.access.queries)
  • Re: Open a form at a specific record
    ... Allen Browne - Microsoft MVP. ... Tips for Access users - http://allenbrowne.com/tips.html ... and I get error message Compile error: Expected: end of statement. ... Dim strWhere As String ...
    (microsoft.public.access.queries)
  • Re: Printing Multiple Copies of a Report Form.
    ... I resolve the error message by adding "True" to the SelectObject method. ... >>> stDocName As String ... >>> DoCmd.OpenReport stDocName, acPrint ... >> If you Dim variables, you should also set their types, otherwise they ...
    (microsoft.public.access.reports)
  • Re: configuring dial-up modem in Linspire
    ... > Linspire 4.5 recognizes it with no problem. ... The modem dials my ISP ... I get an error message saying "pppd has died ... > Num Lock and Caps Lock lights flashing rythmically on the ...
    (alt.linux)
  • Re: Mail to a group
    ... Dim sSQL As String, sEmail As String, sRecip As String ... You've got the email, a recipient name, body text and subject. ... But - I think Your idea of looping the e-mails as You say but the ... the error message is correct and you have a bad address. ...
    (microsoft.public.access.modulesdaovba)