save csv file into phpadmin with a duplicate id no. using php
<p>i have a csv file, containing these data:</p>

<p>SUBJ_CODE   DESCRIPTION       TIME       DAYS      ROOM     UNITS
EC-26765    FORLAN EL   9:30 - 10:30 AM       MWF       203 3
EC-26773    IT 421 L    11:30 - 12:30 PM      MWF       CISC    1
EC-26781    IT 421           5:01 - 6:31 PM       TTH   CISC    2
EC-26823    IT 420           8:30 - 11:30 AM      SAT    MA1    3
EC-26807    IT 423          3:00 - 4:30 PM        TTH    M1 3
EC-26799    IT 422           8:01 - 9:01 PM       TTH    211    2
EC-26815    IT 422 L    6:31 - 8:01 PM        TTH    C1 1
ED-08326    FIL 38          7:30 - 9:00 AM        TTH    EDTE   3
IS-24331    MATH 16         12:00 - 1:30 PM       TTH    203    3</p>

<p>i want to save this csv file into my phpadmin like this:
ID_NO        SUBJ_CODE  DESCRIPTION       TIME       DAYS      ROOM     UNITS
08329        EC-26765   FORLAN EL   9:30 - 10:30 AM       MWF       203 3
08329        EC-26773   IT 421 L    11:30 - 12:30 PM      MWF       CISC    1
08329        EC-26781   IT 421           5:01 - 6:31 PM       TTH   CISC    2
08329        EC-26823   IT 420           8:30 - 11:30 AM      SAT    MA1    3
08329        EC-26807   IT 423          3:00 - 4:30 PM        TTH    M1 3
08329        EC-26799   IT 422           8:01 - 9:01 PM       TTH    211    2
08329        EC-26815   IT 422 L    6:31 - 8:01 PM        TTH    C1 1
08329        ED-08326   FIL 38          7:30 - 9:00 AM        TTH    EDTE   3
08329        IS-24331   MATH 16         12:00 - 1:30 PM       TTH    203    3</p>

<p>this is my code:</p>

<p>

<pre><code>    if(isset($_POST['submit']))     
    {

    if($_FILES["file"]["type"] != "application/vnd.ms-excel")
    {
        echo "This is not a CSV file.";
    }
    elseif(is_uploaded_file($_FILES['file']['tmp_name'])){


        //Process the CSV file
        $handle = fopen($_FILES['file']['tmp_name'], "r");
        $data = fgetcsv($handle, 10000, ","); //Remove if CSV file does not have column headings
        while (($data = fgetcsv($handle, 10000, ",")) !== FALSE) 
        {

            //$att = $myrow['STUD_ID'];
            $att0 = mysql_real_escape_string($data[0]);
            $att1 = mysql_real_escape_string($data[1]);
            $att2 = mysql_real_escape_string($data[2]);
            $att3 = mysql_real_escape_string($data[3]);
            $att4 = mysql_real_escape_string($data[4]);
            $att5 = mysql_real_escape_string($data[5]);

            $sql = "INSERT INTO schedule (IDNO,SUBJ_CODE,DESCRIPTION,TIME,DAYS,ROOM,UNITS)
                                  VALUES ('$att','$att0','$att1','$att2','$att3','$att4','$att5')";
            mysql_query($sql);
        }
        mysql_close($evancon);
        echo "&lt;script&gt;alert('CSV file successfully imported.');&lt;/script&gt;";
    }
    else{
        die("You shouldn't be here");
    }
    }
        ?&gt;
</code></pre>

<p>hope you can answer this question....thank you</p>
