is there a file size limit when creating a csv file using php and mysql? -


i attempting create csv file update inventory in magento. code follows:

    <?php require_once ('../db.php');  $conn = db_connect(); $inventory = array(); $csvcontent = ""; $n=0;   $result = $conn->query("select inventory.sku, book.author, book.title,  book.publisher,     book.pub_date, book.edition, inventory.isbn13, book.binding, book_condition.book_condition, defect.defect, note,     feature, inventory.ourprice, inventory.cost, inventory.quantity, subtitle, weight inventory left join book on book.isbn13 = inventory.isbn13 left join defect on inventory.defect_id = defect.defect_id left join note on inventory.note_id = note.note_id left join feature on inventory.feature_id = feature.feature_id left join book_condition on book_condition.condition_id = defect.condition_id inventory.quantity >0");  $num_rows = $result->num_rows;  if($num_rows > 0) {  while($row = $result->fetch_assoc()) { $inventory[$n] = array('sku' => $row['sku'],         'author' => $row['author'],                     /*'title' => $row['title'],                     'publisher' => $row['publisher'],                     'pub_date' => $row['pub_date'],                     'edition' => $row['edition'],                     'publisher' => $row['publisher'],                     //'isbn10' => $isbn10,                     'isbn13' => $row['isbn13'],                     'binding' => $row['binding'],                     'condition' => $row['condition'],                     'defects' => $row['defect'],                     'notes' => $row['note'],                     'feature' => $row['feature'],                     'price' => number_format($row['ourprice'], 2, '.', ''),         'cost' => $row['cost'],                     'description' => $row['defect'],                     'quantity' => $row['quantity'],         'store' => "default",         'websites' => "base",         'attribute_set' => "books",         'type' => "simple",         'category' => "6",         'type' => "simple",         'image' => "/bcpics/".$row['isbn13'].".gif",         'small_image' => "/bcpics/".$row['isbn13'].".gif",         'thumbnail' => "/bcpics/".$row['isbn13'].".gif",         'page_layout' => "no layout updates",         'options_container' => "block after info column",         'weight' => $row['weight'],             'status' =>"enables",         'tax_class_id' =>"taxable goods",          'visibility'  =>"catalog, search",         'enable_googlecheckout'  =>"yes",         'is_recurring'  =>"no",         'min_qty'  =>"0",*/         'use_config_min_qty' =>"1",         'is_qty_decimal'  =>"0",         'backorders'  =>"0",         'use_config_backorders' =>"1",         'min_sale_qty' =>"1",         'use_config_min_sale_qty' =>"1",         'max_sale_qty'  =>"0",         'use_config_max_sale_qty' =>"1",         'is_in_stock' =>"1",         'use_config_notify_stock_qty' =>"1",         'manage_stock' =>"0",         'use_config_manage_stock' =>"1",         'stock_status_changed_automatically' =>"0",         'use_config_qty_increments' =>"1",         'qty_increments' =>"0",         'use_config_enable_qty_increments' =>"1",         'enable_qty_increments' =>"0",         'store_id' =>"1",         'product_type_id' =>"simple",         'add_delete' => "",         'url_key' => "",         'gift_message_available' => "",         'topic' => "",         'subtitle'=> $row['subtitle'],         'meta_title' => "",         'meta_description' => "",         'custom_design' => "",         'url_path' => "",         'special_price' => "",         'meta_keyword' => "",         'custom_layout_update' => "",         'news_from_date' => "",         'news_to_date' => "",         'special_from_date' => "",         'special_to_date' => "",         'custom_design_from' => "",         'custom_design_to' => "",         'low_stock_date' => "",         'notify_stock_qty' => "",         'product_status_changed' => "",         'product_changed_websites'=> "",         'has_options'=> "0"              );     //print_r($inventory);die;     $n++;     } //end of while loop } // end of if statement  $csvinventory = to_csv($inventory);  function to_csv( $array ) {  $csv = "";   if (count($array) == 0) return "no sku's found";   ## grab first element build header  $arr = array_pop( $array );  $temp = array();  foreach( $arr $key => $data ) {    $temp[] = $key;  }  $csv = implode( ',', $temp ) . "\r\n";   ## add data first element  $csv .= to_csv_line( $arr );   ## add data rest  foreach( $array $arr ) {    $csv .= to_csv_line( $arr );  }   return $csv; }  function to_csv_line( $array ) {  $temp = array();  foreach( $array $elt ) {    $temp[] = '"' . addslashes( $elt ) . '"';  }   $string = implode( ',', $temp ) . "\r\n";   return $string; }  $conn->close();  $myfile = "/home/bookcell/public_html/testbcos/web/inv/bcwebsite" . date("mdy") . ".csv"; $fh = fopen($myfile, 'w') or die("can't open file"); $stringdata = $csvinventory; fwrite($fh, $stringdata); fclose($fh); 

my problem can't work if try use parameters in $inventory[$n] = array(). can 30 rows in array work @ 1 time, in /* , */ not work. have played changing fields between /* , */ know each row go csv without problem. have checked error logs on server , there no error, , transfer log shows should working. see going wrong here? there better way results need?

i have exported 600mb+ sized csv files php , mysql in similar way no issues. sounds problem environment settings - not code or limitation of technologies.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -