Not sure how to format the title. pardon me.
I am using PhpSpreadsheet to INSERT
the Excel column into MySql database.
What i have
What i tried
...
$activeSheet = $spreadsheet->getActiveSheet();
$sheetData = $activeSheet->toArray();
foreach($sheetData as $row) {
$col1 = $row[0];
$sql = "INSERT INTO rowascol (n1) VALUES ($col1)";
$query = mysqli_query($con, $sql);
}
...
What i got
+----+----+----+----+----+----+
| id | n1 | n2 | n3 | n4 | n5 |
+----+----+----+----+----+----+
| 1 | 4 | | | | |
| 2 | 6 | | | | |
| 3 | 45 | | | | |
| 4 | 5 | | | | |
| 5 | 7 | | | | |
+----+----+----+----+----+----+
What i want
+----+----+----+----+----+----+
| id | n1 | n2 | n3 | n4 | n5 |
+----+----+----+----+----+----+
| 1 | 4 | 6 | 45 | 5 | 7 |
| 2 | 9 | 3 | 5 | 8 | 12 |
+----+----+----+----+----+----+