pixeltrace Posted May 10, 2007 Share Posted May 10, 2007 hi, i have a problem, really big, for me my boss gave me a csv file with 6000 rows now i need to upload them to the database. what is the best query to run in phpmyadmin sql query to load this faster? the table has 25 rows but the data that my boss gave me only needs to be inserted to 7 out of the 25 rows only. is there a way to load this faster? thanks! Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/ Share on other sites More sharing options...
ToonMariner Posted May 10, 2007 Share Posted May 10, 2007 I am fairly sure you can import a csv directly by phpmyadmin... Alternatively (and thios wouldn't take long to do) you could write a php script to parse the file and generate sql to be excuted. store it in a txt file and you can insert it all that way (this would also give you option of filtering out rows or columns shoudl you wish. Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249611 Share on other sites More sharing options...
btherl Posted May 10, 2007 Share Posted May 10, 2007 the table has 25 rows but the data that my boss gave me only needs to be inserted to 7 out of the 25 rows only. I assume you mean 7 of 25 columns, not 7 of 25 rows? Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249613 Share on other sites More sharing options...
pixeltrace Posted May 10, 2007 Author Share Posted May 10, 2007 hi, yes. 7 of 25 rows. sorry. hope you could help me with this. what is the php script to run this? i tried importing using csv file but i am getting some problems. all of the items are being inserted to just 1 row instead of going to its respective rows. attached is a copy of my csv file. hope you could help me with this. thanks! Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249690 Share on other sites More sharing options...
jitesh Posted May 10, 2007 Share Posted May 10, 2007 insert into table ('id','name') values (1,'john'),(2,'mark'),('3','craige'), ......................... Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249693 Share on other sites More sharing options...
pixeltrace Posted May 10, 2007 Author Share Posted May 10, 2007 hi, thanks! i am aware about the insert query but my problem now is i have to inpuut 5000 items to the database and the items are inside a csv file. are there any better solutions for this? aside from creating 1 query for each? thanks! Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249786 Share on other sites More sharing options...
pixeltrace Posted May 10, 2007 Author Share Posted May 10, 2007 any help for this? thanks so much! Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-249964 Share on other sites More sharing options...
Barand Posted May 10, 2007 Share Posted May 10, 2007 See reply in your other post. Link to comment https://forums.phpfreaks.com/topic/50761-how-to-insert-multiple-items-to-the-database/#findComment-250190 Share on other sites More sharing options...
Recommended Posts