Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Make a new CSV File Through PHP Script.

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 198
    Comment on it

    This tutorial show's how to create a new CSV file through PHP script.
    This script is more helpful for php developer to create a new CSV file in array formate.

    function functionname (parameter)
    {
        if (($handle = fopen("$data", "r")) !== FALSE) 
        {
            while (($csv_data = fgetcsv($handle, 1000, ",")) !== FALSE) 
            { 
               $categorydata[]=$csv_data;     
                }
            } 
            $categorynum=count($categorydata);
            $categorydata[$categorynum][1]=$new_cat_name;
            $categorydata[$categorynum][2]='1';
            $categorydata[$categorynum][3]='n';
            $categorydata[$categorynum][4]='0';
            $categorydata[$categorynum][5]=$overcategory;
            $filepointer = fopen($data, 'w') or error('ggg');
            foreach($categorydata as $updated_data)
            {
             fputcsv($filepointer,$updated_data);
            }
            fclose($filepointer);
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: