Skip to content

Instantly share code, notes, and snippets.

@umairidrees
Last active December 22, 2015 03:38

Revisions

  1. umairidrees renamed this gist Sep 2, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. umairidrees created this gist Sep 2, 2013.
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    <?php
    if(isset($_POST['submitcsv'])){
    $file = $_FILES['file']['tmp_name'];
    $handle = fopen($file,"r");

    while($file = fgetcsv($handle,1000, ",")){
    $sql = mysql_query("INSERT INTO `table`(`value-1`, `value-2`) VALUES ('$file[0]','$file[1]')");
    };
    }
    ?>


    <form method="post" action="" enctype="multipart/form-data">
    <input type="file" name="file" >
    <input type="submit" name="submitcsv" value="Import" >
    </form>