[Web4lib] ODBC query in PHP

Darryl Friesen Darryl.Friesen at usask.ca
Fri Dec 15 00:46:52 EST 2006


> $result = odbc_exec($connection, $query)  ;
>
> Some basic error reporting tells me that the $result variable
> is empty.


One more thought, just for debugging.  What about something like this:


$result = odbc_exec($connection, $query);
if (empty($result))
{
  echo 'Query failed with error ' . odbc_error() . ': ' . odbc_errormsg() . 
"\n";
}


When the query fails you should at least get the error code and a textual 
message that hopefully will help in debugging (the web server's error log 
might also contain some hint, if you have access to that).

- Darryl

 ----------------------------------------------------------------------
  Darryl Friesen, B.Sc., Programmer/Analyst    Darryl.Friesen at usask.ca
  Information Technology Services Division,     http://gollum.usask.ca/
  University of Saskatchewan Library
 ----------------------------------------------------------------------
  "Go not to the Elves for counsel, for they will say both no and yes" 



More information about the Web4lib mailing list