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

Ran September <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I'm not sure if my problem is still under in this mailing list well
sorry if it's not, but here goes...

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 <<<------------------)
{
  $bigger_than_4096_var = odbc_result($rs, 1);
  unset ($certlink);
  unset ($docstr);
  $job_number=odbc_result($rs,"job_number");
  $open_date=odbc_result($rs,"open_date");
  $status=odbc_result($rs,"wo_custom6");
  if($status == ''){
  	 $status = "UNPAID";
  }
  $customer=odbc_result($rs,"customer");
  $po_number=odbc_result($rs,"po_number");


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.

 // Get most recent cert number.
	odbc_close($conn);
 	$conn2=odbc_connect($db_host2,$db_user2,$db_pass2,SQL_CUR_USE_ODBC);
(----------->>> another server alias and a different user and password
<<<------------)
	$sql2="select job_number from invoice_docs2 where job_number = '$job_number'";
	$rs2=odbc_exec($conn2,$sql2);
	if (!$rs2){
		exit("Error in SQL");
		$pdf=odbc_result($rs2,"estimate_pdf");
	}else{
	  	$certlink = "<a href='inv.php?num=".$job_number."'
target='_blank'>$job_number</a>";
	}$var = odbc_result($rs2,1);	
	
	  //Find associated docs.
			odbc_close($conn2);
			$conn4=odbc_connect($db_host,$db_user,$db_pass,SQL_CUR_USE_ODBC);
			//$sql4="SELECT file_name, event_num FROM eventdocs where event_num
= '".odbc_result($rs2,1)."'";
			$sql4="SELECT file_name, event_num FROM eventdocs where event_num = '$var'";
			$rs4=odbc_exec($conn4,$sql4);
			$edocnum = odbc_result($rs4,"event_num");
			$edocfile = odbc_result($rs4,"file_name");
			if (stristr($edocfile,"mpc.microprecision"))
			  {$docstr = "<a href ='$edocfile' target=_blank><img
src='images/archived.gif' width='20' height='20' border='0'
align='absmiddle' /></a>";}
			elseif ($edocnum != '')
			  {$docstr = "<a href='doc.php?num=$edocnum' target=_blank><img
src='images/doc.gif' width='20' height='20' border='0'
align='absmiddle' /></a>";}

File loading damaged and couldn't load at all.

Thank you in advence! appreciate the help.
-- 
R
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.