Jump to content

kk4iku

New Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kk4iku

  • Rank
    Newbie
  1. I am reading a file and get the information from it I need to update my SQL SERVER but I don't know how to get the values into the sql server update statement. I use the below code to read the file and get the array. With help from an earlier post, I can get the Key value into my sql and it works fine but now I need the key value and the other values in an update statement. This code does a select and shows the order numbers.I will change the select to an update statement.How do I get item1 and item 2 into the sql update statement? Update statement needed: update data.dbo.SalesOrders
  2. so this message is from the FTP server "ftp_get(): Requested action not taken. Message not found.". can I hide it so the user only gets my message?
  3. I am downloading a file from an FTP site and sometimes the file will not be there how can I exit the PHP gracefully ? If there is not a file I get the below error message. ftp_get(): Requested action not taken. Message not found. Error downloading sample.txt if (ftp_get($ftp_conn, $local_file, $ftp_path.$server_file, FTP_ASCII)) { echo "Successfully written to $local_file."; } else { echo "Error downloading $server_file."; ftp_close($ftp_conn); exit; } ftp_close($ftp_conn);
  4. I update my code to use the implode and I changed my sql statement to test and I get the correct results. thanks $lines = []; $fp = fopen('sample.txt', 'r'); while (!feof($fp)) { $line = fgets($fp); $lines[substr($line, 69, 5)] = substr($line, 117, 2); } fclose($fp); $order=array_filter($lines,function($AA){ return $AA=='AA';} ); $key_string = implode(',', array_keys($order)); //print_r($key_string); $sql_update="select ompsalesorderid from .SalesOrders where ompsalesorderid in ($key_string)"; $connect = odbc_connect("1234"); $result = odbc_exec($connect, $sql_update); if(!
  5. I am pulling values from a text file and putting them in an associative array and then filtering them to get what I need. I would then like to use those key values in my MSSQL update statement. But I am not sure how to convey that to my MSSQL statement. How would I do that? <?php $lines = []; $fp = fopen('sample.txt', 'r'); while (!feof($fp)) { $line = fgets($fp); $lines[substr($line, 69, 5)] = substr($line, 117, 2); } fclose($fp); $order=array_filter($lines,function($AA){ return $AA=='AA';} ); $sql_update="update salesorders set ompOrderApproval= -1 where order_id in $orders_
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.