Upload CSV and Insert Data into Mysql Using PHP
Vložit
- čas přidán 17. 04. 2016
- You can find how import data from csv file and insert into mysql table in php. Here I show you user first upload csv file and with help of php code we can get csv file data and make mysql insert query and insert that data to mysql table. Source Code - www.webslesson.info/2016/04/up...
Thank you !
For those who have the error "Notice: Undefined offset: 1", you can replace the line of code "while($data = fgetcsv($handle))" with this one "while($data = fgetcsv($handle,1000,";"))". You must specify the separator.
apart from the computer talk..this really helped me upload a lot of data to the mysql data base.
Thanks for the code...
Kobi
Awesome Tutorial. Thanks Webslesson!!!
Thank you so much. You're so resourceful.
it doesn't work for me. Nothing happens.
very frustrating because I did everything what you did and it doesn't work for me.
Good example. Easy to learn. Thanks.
Apart from saying "friends" 1Milloin times
That wae very helpful ...
Friend 😁♥
Exactly what I was going to say too!
Wow. this is awesome. I never wanted to use third parties library and here is pure php system.
Thank you very clear explanation!
thank you friends
Thanks a lot, you are a hero !
great video it worked for me thanks
thnks sir its working..helpful to me
Hello sir, thanks for code. Sir, i have two queries. When i upload CSV file using this code, CSV heading at the top of csv are also upload in database. Tell me which condition is used for this and also tell me how i validate csv in uploded time using php that data should not repeated again.
Thank you very much sir
Thanks it worked
It is getting inserted but not with actual value... help me out with this
Thanks u so much bro ❤️❤️❤️
Thanks is very useful, but is there any way that I can convert excel file to csv in php without using plagins
Thank you so much
very nice clear and precise thanks a ton
Thanks Mahboob...
thank you
Thanks 😊❤️
csv file add images how can get that image save folded and database add in php
The line :
($_FILES['file']['name'])
Is giving an error as : Undefined index: file
How to solve this issue?
same issue
can u store image using csv
Thank you so much :)
if entry exit then wont be uplaod again ? how to put code in this section and which code?
Is this will be work on live server ??
Thanks
This is fantastic and helpful
How we can add the data by escaping the first row
Use a variable counter. If the counter is greater that '0' then insert the data.
$Flag = 0;
while($data = fgetcsv(($handle))
{
if($Flag != 0)
{
// Execute the insert inside of this if statement
}
if($Flag == 0) $Flag = 1;
}
Thanks :)
i get this notice but i can"t solve the problem
Notice: Undefined offset: 1 in C:\xampp\htdocs\PhpProject1\index.php on line 14
help me to figure it out
thanks
i have the same problem bro can u halp me plz :/
I'm facing the same issue ....now its fixed use the correct csv file format.
@@pranotipatil7070 you can replace the line of code "while($data = fgetcsv($handle))" with this one "while($data = fgetcsv($handle,1000,";"))". You must specify the separator.
Great one.made my life easier... :D (Y)
Thanks Shovon...
Good day sir.
Is this compatible for php 5?
Or 7 only?
Thanks.
Yes, it is compatible with both PHP 5 and 7.
useful
thx friends!
Thanks Kevin...
can i do that with file type is xlsx ?
No, You Can't
Okay i hope they rede and fixit
Thank you
You are most welcome..
Import nhi ho rha hai item1 and...item2 uninitialized bta rha Ha i
after choosing the file when we upload it, it returns no file chosen
where as file ext is .csv
Notice: Undefined offset: 1 in /Applications/MAMP/htdocs/finans_dk.dk/upload_csv/index.php on line 14
again it is a problem in item2 that my mysqli will not accept, there is a solution :-((
Yes, it doesn't work with me either.
When I make a txt file it works.
Not work
Sir to me again and again no file choosen is shown please solve my problem
have you find any solution?
Save your excel file as CSV (Comma Delimited). Choose "CSV (Comma Delimited)" in "Save as type"
how can use 77mb file
Have you tried Zahid Queshi to upload this type of heavy file, for export this type of file you have to set server property.
my csv file is 77mb and not import this file
how import this file
undefined index file : error -- i'm getting
Is there any solution for that error to get clear
i got the same problem.
have you got the answer guys?
Same here.....
Thanks u so much bro ❤️❤️❤️