I have the following code which extracts an item number using one odbc connection and using that item number in another odbc connection, I was hoping it would come out with the data , but it is not. Is this possible or did I miss something?
Thanks
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<table width="75%" border="1" cellspacing="1" cellpadding="1" bgcolor="#FFFFFF">
<tr bgcolor="#CCFFFF">
<td height="22"><b>Cust No</b></td>
<td height="22"><b>Inv Date</b></td>
<td height="22"><b>Total</b></td>
</tr>
<?php
//connect to the database
$conn = odbc_connect("Pass1", "", "");
$Q = "SELECT FPBBDMAS.BBITM FROM FPBBDMAS WHERE FPBBDMAS.BBGPI = '1'";
if (($result = @odbc_exec($conn, $Q)) &&
odbc_fetch_row($result)) {
$genitm = odbc_result($result,1);
}
$conn2 = odbc_connect("Pass2", "", "");
//SQL query
$custid = "160294";
$custid2 = "162354";
$custid3 = "169834";
$custid4 = "220460";
$Query = "SELECT FPORDDTL.OTCBIL, FPORDDTL.OTIVDT, sum(FPORDDTL.ORDTSQ * FPORDDTL.OTCACT) as totdlrs";
$Query .= " From FPORDDTL where FPORDDTL.ORDTIT = $genitm and";
$Query .= " FPORDDTL.OTIVDT = 20030602 and FPORDDTL.OTCBIL = $custid group by FPORDDTL.OTCBIL, FPORDDTL.OTIVDT";
//execute query
$queryexe = odbc_exec($conn2,$Query);
//query database
while(odbc_fetch_row($queryexe))
{
$custno = odbc_result($queryexe, 1);
$invdate = odbc_result($queryexe, 2);
$total = odbc_result($queryexe, 3);
//format results
print ("<tr>");
print ("<td>$custno</td>");
print ("<td>$invdate</td>");
print ("<td>$total</td>");
print ("</tr>");
}
//disconnect from database
odbc_close($conn);
odbc_close($conn2);
?>
</table>
</body>
</html>