Jump to content

Search the Community

Showing results for tags 'php writes csv file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hey guys, I have a script that writes an order to a CSV file, the problem is I need to add the comment field to the last line of data instead of the header how it is currently written. Here is what we currently have, How do I move it from the header to the data field? $order_fields_1 = array ( array('OrdNum', 'OrdTyp', 'CompNbr', 'CustNum', 'WhsID','CustPurchOrdNum','OrdSrc','EntDate','BillAddress1','BillAddress2','BillCity','BillState','BillZip','BillPhone','ShipToName','ShipToCompany','ShipToAddress1','ShipToAddress2','ShipToCity','ShipToState','ShipToZip','ShipToPhone','Comment'), array($order->id, 'O', '1',$manual_customer_id,'1',$orderNumber,'W',date('m/d/y')), ); //$order_fields[] = array("H",$order->id, 'O', '1',$manual_customer_id,'1',$orderNumber,'WB',date('m/d/y'),$fields['address1'],$fields['address2'],$fields['city'],StateCore::getNameById($fields['id_state']),$fields['postcode'],$fields['phone_mobile'],$fields['firstname'],$fields['company'],$fields['ship_address1'],$fields['ship_address2'],$fields['ship_city'],StateCore::getNameById($fields['id_ship_state']),$fields['ship_postcode'],$fields['ship_phone_mobile'],$message[0]['message']); $order_fields[] = array("H",$order->id, 'O', '1',$manual_customer_id,'1',$orderNumber,'WB',date('m/d/y'), $invoice_address_fields['address1'],$invoice_address_fields['address2'],$invoice_address_fields['city'],StateCore::getNameById($invoice_address_fields['id_state']),$invoice_address_fields['postcode'],$invoice_address_fields['phone_mobile'], $delivery_address_fields['firstname']." ".$delivery_address_fields['lastname'],$delivery_address_fields['company'], $delivery_address_fields['address1'],$delivery_address_fields['address2'],$delivery_address_fields['city'],StateCore::getNameById($delivery_address_fields['id_state']),$delivery_address_fields['postcode'],$delivery_address_fields['phone_mobile'], $message[0]['message']); $order_fields_2[0] = array('OrdNum', 'OrdSeqNum', 'LineItemTyp', 'ItemNum', 'QtyOrd','UntMeas','','','','','','','','','','','','','','','','',''); $products_in_cart = $cart->getProducts(); if(is_array($products_in_cart)){ $i=1; foreach($products_in_cart as $cartp){ $order_fields_2[$i] = array($order->id,$i,'I',$cartp['attributes_small'],$cartp['cart_quantity'],'','','','','','','','','','','','','','','','','',''); $order_fields[] = array("D",$order->id,$i,'I',$cartp['attributes_small'],$cartp['cart_quantity'],'','','','','','','','','','','','','','','','',''); $i++; } Thanks My csv file output is suppose to look like this but with the current code it writes to the H, I need to write it to the last D: where its say C, Comments, Thanks: H,88,O,1,9610,1,M2834,WB,01/16/13,billaddress1,billaddress2,billtocity,billtostate,billtozip,billtophone,shiptoname,shiptocompany,shiptoadd1,shiptoadd2,shiptocity,shiptostate,shiptozip,shiptophone D,88,1,I,MB500S,2,,,,,,,,,,,,,,,, D,88,2,I,EL450MT,1,,,,,,,,,,,,,,,, D,88,3,I,EL450BS,1,,,,,,,,,,,,,,,, D,88,4,C,Comment,0,,,,,,,,,,,,,,,,
×
×
  • 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.