I have a huge PHP array of the form:
Array
(
[0] => ('A', 'B', 'C', 'D', 'E', 'F')
[1] => ('G', 'H', 'I', 'J', 'K', 'L')
[2] => ('M', 'N', 'O', 'P', 'Q', 'R')
....
[30000] => ('S', 'T', 'U', 'V', 'W', 'X')
)
As you can see, my array contains 30,000 entries. I'm trying to use the implode() function to convert my array to a string of the form:
$values = ('A', 'B', 'C', 'D', 'E', 'F'), ('G', 'H', 'I', 'J', 'K', 'L'), ('M', 'N', 'O', 'P', 'Q', 'R'), ('S', 'T', 'U', 'V', 'W', 'X')
To be able to do a MySQL INSERT query. So in order words, I'm trying to insert 30,000 entries into a database table in one shot (without doing it in a loop or something) like:
INSERT INTO table_name VALUES $values;
The problem I'm having is that the implode function doesn't seem to implode my gigantic array. When I try to debug the string to see if my array has been imploded, I get empty string or something.
Does anybody know how I can fix this or if there is a better way to do this? Again, I don't want to query my database 30,000 times, I just want to do the insert at once.
Thank you