I am using this code and when i try to insert the a value in the 4th field after tdno, it doesn't insert all the values in the database. please help!

<?php  
error_reporting (E_ALL ^ E_NOTICE);
//connect to the database 
$connect = mysql_connect("localhost","root","root"); 
mysql_select_db("rizal",$connect); //select the table 
// 

if ($_FILES[csv][size] > 0) { 

    //get the csv file 
    $file = $_FILES[csv][tmp_name]; 
    $handle = fopen($file,"r"); 

    //loop through the csv file and insert into database 
    do { 
        if ($data[0]) { 
            mysql_query("INSERT INTO bank_reports (userid,amountpaid,tdno) VALUES 
                ( 
                    '".addslashes($data[0])."', 
                    '".addslashes($data[1])."', 
                    '".addslashes($data[2])."'

                ) 
            "); 
        } 
    } while ($data = fgetcsv($handle,1000,",","'")); 
    // 

    //redirect 
    header('Location: import.php?success=1'); die; 

} 

?> 
Member Avatar

LastMitch

@erikadiaz000

Is this related to an E-commerce script?

INSERT INTO bank_reports (userid,amountpaid,tdno)

Did you create those other categories on your db? You have to create a category in the db before you can Insert the data

commented: To Rectify what some retard did to LastMitch +0