0

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; 

} 

?> 
2
Contributors
1
Reply
3
Views
4 Years
Discussion Span
Last Post by LastMitch
3

@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

Votes + Comments
To Rectify what some retard did to LastMitch
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.