chukwuemmanuel09's Profile User Rating: -----

Reputation: -10 Disgraced
Group:
Active Members
Active Posts:
60 (0.05 per day)
Joined:
18-August 11
Profile Views:
783
Last Active:
User is offline Jul 01 2013 06:13 AM
Currently:
Offline

Previous Fields

Country:
Who Cares
OS Preference:
Who Cares
Favorite Browser:
Who Cares
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Who Cares
Your Car:
Who Cares
Dream Kudos:
0
Icon   chukwuemmanuel09 has not set their status

Posts I've Made

  1. In Topic: Exporting data Into CSv.

    Posted 28 Jun 2013

    I have finally solved it, i just changed $handle = fopen($filename, 'w+') to $handle = fopen($filename, 'a+');

    Thanks All.
  2. In Topic: Exporting data Into CSv.

    Posted 28 Jun 2013

    Hi, Please am i missing anything? Can some one point me in the right direction.
  3. In Topic: Exporting data Into CSv.

    Posted 28 Jun 2013

    Have made some progress with the (fputcsv()) function, but still having some issues

    	      ini_set('display_errors',1); 
    		   error_reporting(E_ALL);
        
    
       
              $sql = "select * from " . TABLE_ORDERS . "";
              $result = $db->Execute($sql);
    
           
    
    
              if ($result->RecordCount() > 0) {
                  while (!$result->EOF) {
    			
    			$file_date = date("d_m_Y_G_i_s");
    			$filename = "../weight/weightExport_".$file_date .".csv";  
    			
    			$customers_Name =  $result->fields['customers_name']; 
           
                $list = array($customers_Name);
                
                /*If i print the $list variable here everything seems fine.*/
                print_r($list)."<br/>";
    			
                $handle = fopen($filename, 'w+');
    			
                fputcsv($handle, array('Username'));
               
                /*if i copy it into a csv file, only one row gets exported*/
                fputcsv($handle, $list);
    
    			fclose($handle);
                                     
    
                $result->MoveNext();                    
    
    		    }
    	}
    
    
  4. In Topic: Exporting data Into CSv.

    Posted 27 Jun 2013

    Hi, thanks..Thats an option but i really want to use this (fputcsv()), it makes the code a bit clean.

    the //echo $line; works well, the only problem is inputting it into the csv. :(
  5. In Topic: Exporting data Into CSv.

    Posted 27 Jun 2013

    Update the code with the (fputcsv()), But still not downloading to csv.
    	<?php
        
               $sql = "select * from " . TABLE_ORDERS . "";
    	       $result = $db->Execute($sql);
    	
    	       
    
    
               if ($result->RecordCount() > 0) {
                   while (!$result->EOF) {
    				
    				/*
    				creturn the date and time here
    				*/
    				$datetime = $result->fields['date_purchased']; 
    				//use explode here to seperate them
    				$date = explode(" ",$datetime);
    				
    	
    			     $customers_Name =  $result->fields['customers_name']; 
    			     $date =  $date[0];
    				 $delivery_street = $result->fields['delivery_street_address'];
                     $delivery_city = $result->fields['delivery_city']. '<br/><br/>'; 	
                         
                          
                        
                     $list = array($customers_Name,$date,$delivery_street,$delivery_city);
    
                        $file = fopen("contacts.csv","w");
    
    					foreach ($list as $line)
    					  {
    						//echo $line;
    					  fputcsv($file,$line);
    					  }
    
    					fclose($file);
                                      
    
                        $result->MoveNext();                    
     
    					  }
    		
    
        ?>
    
    

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Location:
Aberdeen
Years Programming:
1

Contact Information

E-mail:
Private

Friends

chukwuemmanuel09 hasn't added any friends yet.

Comments

Page 1 of 1
  1. Photo

    chukwuemmanuel09 Icon

    19 Aug 2011 - 09:33
    Yes Pal..i have to bc i need to submit my project soon.
  2. Photo

    paradoxia Icon

    19 Aug 2011 - 07:38
    you got so many posts on your first day
Page 1 of 1