Re: Warning: odbc_fetch_row(): 6 is not a valid ODBC result resource in /var/www/localhost/htdocs/customer.microprecision.com/invlist.php on line 81

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Ran September wrote:
> i don't know where i went wrong, my script seems alright and i'm
> pretty sure that i prevented the "Multiple active statement" thing (at
> least that's what i believed)
> 
> $conn=odbc_connect($db_host,$db_user,$db_pass);
> $sql="SELECT *  FROM invoice where customer = '$custid' AND
> INVOICE.WO_CUSTOM2 != 'MPTE'";
> $rs=odbc_exec($conn,$sql);
> if (!$rs)
>   {exit("Error in SQL");} (---------------------->>> the connection
> worked! <<<---------------------------)
>   ?>
> 
> odbc_binmode($rs, ODBC_BINMODE_PASSTHRU);
> odbc_longreadlen($rs, 100384); /* Allow 16kb thru */
> while (odbc_fetch_row($rs))           (--------------------->>> this
> is where the error pointed at <<<------------------)

Try looking at a TDSDUMP log of the session; see if any error message is
generated in response to odbc_longreadlen.  (I'm not a PHP programmer, but
do odbc_binmode() and odbc_longreadlen() not have return codes?)  You
might also try using the ODBC trace.  

Four our purposes here, you need to isolate the ODBC function call that is
not working as expected.  Then we can see what is reasonable to expect,
and what kind of change or righteous indignation would be appropriate.  

> and also, using freetds, can it load pdf files? if yes, is there a
> limit from loading big files? because it worked on windows i mean when
> the time that i didn't have to use freetds driver.

Yes, it should work.  You're limited by available memory -- more than one
copy of the file is kept in memory -- and newer versions are better at it
than older ones.  I don't know how well ODBC parameterized queries work
with large parameters.  Here again an ODBC trace and TDSDUMP should shed
some light.  

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.