So I basically have 2 arrays with a lot of numbers in them, I implode them:
$array1 = implode(", ", $array1);
$array2 = implode(", ", $array2);
When I echo $array1 and $array2 it looks okay, numbers separated by commas
But when I use:
"INSERT INTO table1 (array1, array2) VALUES ('$array1', '$array2')";
It only inserts first number (which is the first row in the csv file), what should I do now?
Possible solution in it's most basic form
$array1 = Array(1,2,3,4,5);
$array2 = Array("one","two","three","four","five");
while(count($array1)>0){
$a1 = array_shift($array1);
$b1 = array_shift($array2);
mysql_query("INSERT INTO table (numeric,alpha) VALUES('$a1','$b1')");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.