You are here: odbc_error() questions « PHP Programming Language « IT news, forums, messages
odbc_error() questions

Posted by Wescotte on 09/26/64 11:37

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация