Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6224469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:40:42+00:00 2026-05-24T08:40:42+00:00

Following is my script to upload the table employee with a csv file. The

  • 0

Following is my script to upload the table employee with a csv file. The file is uploading and upldating the employee table perfectly. BUT the problem is i specified a row with headings in the csv file. That heading row is also getting updated in the table. I want only those datas to get uploaded except the heading row in the csv file, any help or ideas?.

<?php
require_once '../config.php';

if(isset($_POST['upload']))
{
$fname = $_FILES['sel_file']['name'];
$chk_file = explode(".",$fname);

if(strtolower($chk_file[1]) == 'csv')
{
$filename = $_FILES['sel_file']['tmp_name'];
$handle = fopen($filename,"r");

while(($data = fgetcsv($handle,1000,",")) != false)
{
$sql = "INSERT into   employee(employee_code,employee_name,employee_address,emp_dateofjoin,emp_designation,emp_hq,pf_num,esic_num,emp_state,month,tot_work_days,lop_days,arrear_amt,leave_encash) values('$data[0]','$data[1]','$data[2]','$data[3]','$data[4]','$data[5]','$data[6]','$data[7]','$data[8]','$data[9]','$data[10]','$data[11]','$data[12]','$data[13]')";

/$upd = "UPDATE student SET   month='',tot_work_days='',lop_days='',arrear_amt='',leave_encash='' where  employee_code=''";
    mysql_query($sql) or die(mysql_error());
    }
    fclose($handle);
    echo "Successfully Imported";
}
else
{
    echo "Invalid File";
}
}

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:40:43+00:00Added an answer on May 24, 2026 at 8:40 am

    Skip the first line by calling fgetcsv once before your loop:

    fgetcsv($handle,1000,",");
    while(($data = fgetcsv($handle,1000,",")) != false)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In tcsh , I have the following script working: #!/bin/tcsh setenv X_ROOT /some/specified/path setenv
I have the following shell script registered in my Login Items preferences but it
I'm trying to upload a 95 GB CSV file into a MySQL database (MySQL
I need to upload a massive (16GB, 65+ million records) CSV file to a
I am creating file upload script and I'm looking for the best techniques and
I am trying to upload a file of 1GB size using php script and
I am programming a script to upload images to my application. Are the following
I am initializing file upload using the following HTML: <form enctype=multipart/form-data action=PHPScripts/upload.php method=POST> <input
I have a question. I have a script that handles file upload, and after
I have the following script. It replaces all instances of @lookFor with @replaceWith in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.