I am getting Order number, Order Status, and assignment number from a file that I download and I need to take this information and update a sql server table but I really don’t know how to do that. In my code you will see that I echo the statements out then copy those run them in sql query manager. I can connect to my sql server and run a select statement.
[php]$connect = odbc_connect(“removed”);
if (!$connect) {
exit("Connection Failed: " . $connect);
}
$approve_statues=array(“AA”,“AC”,“AD”,“AX”);
$decline_ststus=array(“DA”,“DR”,“HC”,“CI”,“CR”,“CZ”);
$local_file=‘CCDATA1.TXT’;
sleep(2);
$fp = fopen($local_file, ‘r’);
while (!feof($fp))
{
$line = fgets($fp);
$order = substr($line, 69, 5);
$status=substr($line, 117, 2);
$assignment=substr($line, 91, 10);
$order=ltrim(rtrim($order));
if (in_array($status,$approve_statues)){
$file_array= array($order=> array($assignment,$status));
//echo json_encode($file_array);
echo “
“;
// $sql_update=””;
// $update = odbc_exec($connect, $sql_update);
}
elseif (in_array($status,$decline_ststus)){
echo “
“;
// $sql_update=””;
// $update = odbc_exec($connect, $sql_update);
}
}
fclose($fp);
odbc_close($connect);[/php]