I would like to output a odbc query to a text file. I have the
following php code but it isnt working.
<?
//conneccion
$conn=odbc_connect('DBA','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
$sql="SELECT BKAR_INV_SONUM FROM BKARINV WHERE BKAR_INV_ORDDTE >=
'2008-6-01' and BKAR_INV_ORDDTE <= '2008-6-30' AND BKAR_INV_LOC =
'UNI' AND BKAR_INV_INVDTE IS NULL";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
while (odbc_fetch_array ($rs))
{
$so=odbc_result($rs,"BKAR_INV_SONUM");
$f = fopen("tmp_temp.csv", "w");
fwrite($f, $so);
}
fclose($f);
odbc_close($conn);
?>
I was reading on the net that I need to send the query output to an
array, but not a clue how to do it.
Thanks,