Could some one help me out for some reason im getting an error and can not figure out why!!!! I have about 45 columns and im only needing to use 1,2,3,4,7,8 from the table so i cant load everything.
<?
$con=mysqli_connect("localhost","*******","*****","******");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
//get the csv file
$file = "tickets/feed/rtc.csv";
$handle = fopen($file,"r");
$count=0;
$sid="32837459823";
//loop through the csv file and insert into database
do {
if ($data[0]) {
mysqli_query($con,"INSERT INTO carlist (id, stknum, vin, vt, stat, other, store_id) VALUES
(
'".$count++."',
'".addslashes($data[7])."',
'".addslashes($data[8])."',
'".addslashes($data[2].$data[3].$data[4])."',
'".addslashes($data[1])."',
'".addslashes("0")."',
'".addslashes($sid)."'
)
");
}
} while ($data = fgetcsv($handle,1000,",","'"));
//
?>
Here is the errors im getting
Notice: Undefined variable: data in /home1/inventory/mobile/actions/loadsubmit.php on line 139
Notice: Undefined offset: 7 in /home1/inventory/mobile/actions/loadsubmit.php on line 139
Notice: Undefined offset: 8 in /home1/inventory/mobile/actions/loadsubmit.php on line 140
Notice: Undefined offset: 2 in /home1/inventory/mobile/actions/loadsubmit.php on line 141
Notice: Undefined offset: 3 in /home1/inventory/mobile/actions/loadsubmit.php on line 141
Notice: Undefined offset: 4 in /home1/inventory/mobile/actions/loadsubmit.php on line 141
Notice: Undefined offset: 1 in /home1/inventory/mobile/actions/loadsubmit.php on line 142