[freetds] sql problem?

kenn kenn at printussery.com
Fri Aug 11 16:09:28 EDT 2006


Okay, this is probably a failure on my part to understand, but the
following code works on the SQL server itself:

SELECT     AAPTHEAD.ESTNO, AAPTHEAD.PARTNO, AAPTHEAD.PARTDES,
AAPTHEAD.PARTDES2, AAPTHEAD.LEAV1, AAPTHEAD.LEAV2, AAPTHEAD.LEAV3,
                      AAPTHEAD.LEAV4, AAPTHEAD.LEAV5, AAPTHEAD.LEAV6,
AASTOCKS.MATERIAL
FROM         AAPTHEAD INNER JOIN
                      AASTOCKS ON AAPTHEAD.ESTNO = AASTOCKS.ESTNO AND
AAPTHEAD.PARTNO = AASTOCKS.PARTNO
WHERE     (AAPTHEAD.ESTNO = '90763') AND (CAST(AAPTHEAD.PARTNO AS int) =
'1')

returns the expected answers ...

but when I try the following, the variables are always empty ....

$query = mssql_query("SELECT  ESTNO, PARTNO, PARTDES, PARTDES2
FROM         AAPTHEAD
WHERE     (ESTNO = '$estimate_number')  AND (CAST(PARTNO AS int) = '1')
 ");

	  if ($row = mssql_fetch_array($query)) {
do {
$estnumber = $row["AAPTHEAD.ESTNO"];

 echo "part description for part $i is $estnumber <br>";
}
 while($row = mssql_fetch_array($query)); } else {print "<p> No matches
found.";}


What am I doing wrong?  (And if I should be posting this to the PHP
list, my apologies ....)

Kenn



More information about the FreeTDS mailing list