MYSQL excel input 'lege regel overslaan'

Status
Niet open voor verdere reacties.

BZilla

Gebruiker
Lid geworden
16 apr 2014
Berichten
170
Beste allen,

Ik ben bezig met een prorgamma waarbij je een excel bestand in de database kan uploaden.
Nu was het geval dat wanneer er een lege regel in het bestand stond, de volgorde niet meer klopte.
Nu wil ik dat wanneer er een lege regel in het excel bestand staat, hij deze niet in de database invoert. Dit probeer ik doormiddel van een teller.

Ik tel eerst de regels, en laat de query net zo lang doorgaan tot er geen regel meer over is. Wanneer een query gelijk is aan '' dan moet hij de query niet uitvoeren, en alleen de teller ophogen.
Nu krijg ik deze error:

'Error: Column count doesn't match value count at row 11'
Row 11 is in het bestand dus de eerste lege regel.

PHP:
$x = 2;
$strsql3 = "INSERT INTO `".$fileName."` VALUES ";
while($x <= $sheet['numRows'])
{
	$y = 1;
	$strsql3.="(0";
	while($y <= $sheet['numCols'])
	{
		$cell = $sheet['cells'][$x][$y] ;
		$strsql3 .= ", '".$cell."'";
		$y++;
	}
	$strsql3 .= ")";
	if ($x<$sheet['numRows'])
	{
		$strsql3 .= ",";
	}
	$x++;
}
$result = mysql_query($strsql3);
if($result == FALSE)
{
	die('Error: '. mysql_error());
}
if($result == TRUE)
{
	//reload the page index.php when the function is done.
	Header("Location: index.php");
}

Iemand enig idee hoe ik dit oplos?
Indien dit niet duidelijk is hoor ik dit graag.

Alvast bedankt!

BZilla
 
Die error komt omdat je de kolommen niet aangeeft in je query.

MySQL verwacht nu dat je voor elke kolom een waarde invoert.
In plaats van de teller op te hogen zou ik de waarde NULL meegeven (wel zorgen dat je kolommen NULL accepteren)
 
bedankt voor het reageren.
Wat ik eruit begrijp is dat ik Y (de teller) de waarde NULL moet geven, is dit correct?

dus
PHP:
if($cellRow <> '') //als $cellRow (de gehele rij) niet leeg is(dus niet gelijk aan niks) dan voert hij de query uit.
{
	$strsql2 .= ", '".$cellRow."'"; //geeft alle data uit de cel.
	$y++;
}
else
{
	$y = NULL;
}

Waarschijnlijk begrijp ik het verkeerd, indien ik dit doe blijft de pagina laden.
 
Stel je Excel ziet er zo uit:

[table="width: 300"]
[tr]
[td]id[/td]
[td]voornaam[/td]
[td]achternaam[/td]
[/tr]
[tr]
[td]1[/td]
[td]Pieter[/td]
[td]Post[/td]
[/tr]
[tr]
[td]2[/td]
[td][/td]
[td]Beton[/td]
[/tr]
[tr]
[td]3[/td]
[td]Joep[/td]
[td][/td]
[/tr]
[/table]

Dan zou je query dit moeten worden:
[sql]
INSERT INTO tabel VALUES
(1, "Pieter", "Post"),
(2, NULL, "Beton"),
(3, "Joep", NULL)
;[/sql]

In jouw stukje code dus waarschijnlijk zo:
PHP:
if($cellRow <> '') //als $cellRow (de gehele rij) niet leeg is(dus niet gelijk aan niks) dan voert hij de query uit.
{
    $strsql2 .= ", '".$cellRow."'"; //geeft alle data uit de cel.
    $y++;
}
else
{
    $strsql2 .= ", NULL"; // Voer een lege waarde in voor deze kolom
}
Je hoeft dan dus geen teller meer bij te houden volgens mij.
 
Ik ben niet duidelijk geweest in mijn verhaal haha.

Het gaat per regel.
Dus stel dit is mijn database :
id Voornaam Achternaam
1 Pieter Post

3 Jan Beton

Dan staat er dus een lege regel, id 2 is er niet, of in sommige gevallen is er gewoon een lege lijn 'perongelijk' neergezet.
Deze regel moet hij dan volledig overslaan, dus niet per cel.

Maar voor dat heb ik een probleem.. een tijd heb ik met deze fout gezeten, een ander deel afgemaakt, en nu ik terug kijk, krijg ik in elke cell de waarde 'Array'..
Enig idee wat de fout is? Voorheen werkte dit wel.

PHP:
		$x = 2;
		$strsql3 = "INSERT INTO `".$fileName."` VALUES ";
		while($x <= $sheet['numRows'])
		{
			$y = 1;
			$strsql3.="(0";
			while($y <= $sheet['numCols'])
			{
				$cell = $sheet['cells'][$x][$y] ;
				$strsql3 .= ", '".$cell."'";
				$y++;
			}
			$strsql3 .= ")";
			if ($x<$sheet['numRows'])
			{
				$strsql3 .= ",";
			}
			$x++;
		}
		$result = mysql_query($strsql3);
		if($result == FALSE)
		{
			die('Error: '. mysql_error());
		}
		if($result == TRUE)
		{
			//reload the page index.php when the function is done.
			Header("Location: index.php");
		}
	}
}
$nr_sheets = 1;       // gets the number of worksheets
$excel_title = '';              // to store data of each sheet
// traverses the number of sheets and sets html table with each sheet data in $excel_data
for($i=0; $i<$nr_sheets; $i++)
{
	$excel_title .= sheetTitle($excel->sheets[$i]);
}
function sheetData($sheet)
{
	// fill all the rows with data from the excel sheet.
	$fileName = $_POST['name'];
	$x = 2;
	$strsql2 = "INSERT INTO `".$fileName."` VALUES ";
	while($x <= $sheet['numRows'])
	{
		$y = 1;
		$strsql2.="(0";
		while($y <= $sheet['numCols'])
		{
			$cell = $sheet['cells'][$x][$y]; //takes the cells by x and y value (rows and columns)
			$cellRow = $sheet['cells'][$x]; //takes the cells by x values (rows)
			/*if($cellRow <> '') //als $cellRow (de gehele rij) niet leeg is(dus niet gelijk aan niks) dan voert hij de query uit.
			{*/
				$strsql2 .= ", '".$cellRow."'"; //geeft alle data uit de cel.
				$y++;
			//}
			/*else
			{
				$y++;
			}*/
		}
		$strsql2 .= ")";
		if ($x<$sheet['numRows'])
		{
			$strsql2 .= ",";
		}
		$x++;
	}
	$result = mysql_query($strsql2);
	if($result == FALSE)
	{
		die('Error: '. mysql_error());
	}
	if($result == TRUE)
	{
		//reload the page index.php when the function is done.
		Header("Location: index.php");
	}
}
$nr_sheets = count($excel->sheets);       // gets the number of worksheets
$excel_data = '';              // to store data of each sheet
// traverses the number of sheets and sets data in $excel_data
for($i=0; $i<$nr_sheets; $i++)
{
	$excel_data .= sheetData($excel->sheets[0]) .'<br/>';
}

Edit:

De bovenstaande insert into werkt wel, dat is de eerste line met de column names.
De data (2e insert into) krijgt waarde array terug. tenzij de cell leeg is.

Alvast bedankt.
 
Laatst bewerkt:
Wat is dan de reden dat je een teller bijhoudt?

In feite wil je dus deze uitkomst:
[sql]
INSERT INTO tabel VALUES
(1, "Pieter", "Post"),
(3, "Jan", "Beton")
;[/sql]

Als je met een foreach alle rijen doorloopt kun je ze zo overslaan.
Ik vermoed dat je het Excel-bestand in een multi-dimensionale array krijgt dus:
PHP:
$sheet = array(
    0 => array(
        0 => "1",
        1 => "Pieter",
        2 => "Post"
    ),
    1 => array(
        0 => "",
        1 => "",
        2 => ""
    ),
    2 => array(
        0 => "3",
        1 => "Jan",
        2 => "Beton"
    )
);

Dan gaan we alle rijen doorlopen:
PHP:
$fileName = "test";
$sheet = array(
    0 => array(
        0 => "1",
        1 => "Pieter",
        2 => "Post"
    ),
    1 => array(
        0 => "",
        1 => "",
        2 => ""
    ),
    2 => array(
        0 => "3",
        1 => "Jan",
        2 => "Beton"
    )
);

$query = "INSERT INTO `". $fileName ."` VALUES ";
$values = array();
foreach($sheet AS $row) {
    $rowValues = implode(",", $row);
    // Lege rijen overslaan
    // Het aantal komma's moet overeenkomen met het aantal kolommen - 1
    if($rowValues == ",,") {
        continue;
    }
    $values[] = "(0,". $rowValues .")";
}
$query .= implode(", ", $values) .";";
var_dump($query);
 
De reden waarom ik een teller bij houdt is omdat ik de waarde X en de waarde Y bij houdt.

Dus hoeveel colommen en hoeveel rijen er zijn.
Wanneer Y groter is dan het aantal rijen zal de query stoppen.

De rest snap ik niet hellemaal (beginner...) Moet ik de code van jou proberen? of wil je dat ik iets toevoeg in mijn code?
 
Kun je het resultaat van een var_dump van $sheet hier plaatsen?
PHP:
var_dump($sheet);

Dan zou ik mijn code daarop aan kunnen passen zodat je (naar mijn mening) de juiste query er uit krijgt :)
 
De fout gevonden...

Dit is de goede code
PHP:
while($y <= $sheet['numCols'])
{
	$cell = $sheet['cells'][$x][$y]; //takes the cells by x and y value (rows and columns)
	$cellRow = $sheet['cells'][$x]; //takes the cells by x values (rows)
	/*if($cellRow <> '') //als $cellRow (de gehele rij) niet leeg is(dus niet gelijk aan niks) dan voert hij de query uit.
	{*/
		$strsql2 .= ", '".$cell."'"; //geeft alle data uit de cel.

		$y++;
	/*}
	else
	{
		$y++;
	}*/
}

$cell in de query had ik eerst $cellRow...
Deze is dus opgelost iig bedankt.

Nu het probleem dus nog dat wanneer een hele regel leeg is, hij de regel moet overslaan.
 
Je wou nog de output van var_dump($sheet)..

komt het:
Code:
array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } } array(6) { ["maxrow"]=> int(0) ["maxcol"]=> int(0) ["numRows"]=> int(19) ["numCols"]=> int(7) ["cells"]=> array(13) { [1]=> array(7) { [1]=> string(4) "gggg" [2]=> string(4) "ffff" [3]=> string(4) "eeee" [4]=> string(4) "dddd" [5]=> string(4) "cccc" [6]=> string(4) "bbbb" [7]=> string(4) "aaaa" } [2]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "1" [5]=> string(3) "111" [6]=> string(1) "2" [7]=> string(2) "23" } [3]=> array(7) { [1]=> string(1) "2" [2]=> string(1) "2" [3]=> string(1) "2" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgh" } [4]=> array(7) { [1]=> string(1) "3" [2]=> string(1) "3" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "asd" } [5]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "3" [4]=> string(1) "1" [5]=> string(3) "dfg" [6]=> string(2) "fd" [7]=> string(3) "asd" } [6]=> array(7) { [1]=> string(2) "23" [2]=> string(1) "d" [3]=> string(1) "3" [4]=> string(1) "3" [5]=> string(4) "dgaa" [6]=> string(3) "dfd" [7]=> string(3) "dss" } [7]=> array(6) { [1]=> string(1) "1" [2]=> string(1) "1" [3]=> string(1) "2" [5]=> string(3) "dfg" [6]=> string(5) "dfgdf" [7]=> string(3) "fgf" } [8]=> array(7) { [1]=> string(3) "123" [2]=> string(3) "231" [3]=> string(1) "1" [4]=> string(1) "4" [5]=> string(3) "dfg" [6]=> string(3) "sdf" [7]=> string(3) "ghj" } [9]=> array(5) { [1]=> string(3) "123" [2]=> string(1) "a" [4]=> string(1) "1" [5]=> string(3) "dfg" [7]=> string(3) "jhk" } [10]=> array(6) { [1]=> string(3) "123" [2]=> string(1) "s" [3]=> string(1) "1" [4]=> string(1) "3" [5]=> string(3) "dfg" [7]=> string(3) "asd" } [11]=> array(7) { [1]=> string(1) "1" [2]=> string(1) "d" [3]=> string(1) "2" [4]=> string(1) "3" [5]=> string(3) "dfg" [6]=> string(2) "ad" [7]=> string(3) "fgh" } [15]=> array(7) { [1]=> string(2) "45" [2]=> string(2) "65" [3]=> string(2) "56" [4]=> string(1) "6" [5]=> string(1) "4" [6]=> string(1) "5" [7]=> string(1) "6" } [19]=> array(7) { [1]=> string(1) "6" [2]=> string(1) "5" [3]=> string(1) "4" [4]=> string(1) "7" [5]=> string(1) "8" [6]=> string(1) "5" [7]=> string(1) "1" } } ["cellsInfo"]=> array(12) { [2]=> array(7) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(111) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } } [3]=> array(4) { [1]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [4]=> array(4) { [1]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [5]=> array(4) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [6]=> array(3) { [1]=> array(2) { ["raw"]=> int(23) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [7]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } } [8]=> array(4) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(231) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } } [9]=> array(2) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } [10]=> array(3) { [1]=> array(2) { ["raw"]=> int(123) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [11]=> array(3) { [1]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(2) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(3) ["type"]=> string(7) "unknown" } } [15]=> array(7) { [1]=> array(2) { ["raw"]=> int(45) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(65) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(56) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } } [19]=> array(7) { [1]=> array(2) { ["raw"]=> int(6) ["type"]=> string(7) "unknown" } [2]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [3]=> array(2) { ["raw"]=> int(4) ["type"]=> string(7) "unknown" } [4]=> array(2) { ["raw"]=> int(7) ["type"]=> string(7) "unknown" } [5]=> array(2) { ["raw"]=> int(8) ["type"]=> string(7) "unknown" } [6]=> array(2) { ["raw"]=> int(5) ["type"]=> string(7) "unknown" } [7]=> array(2) { ["raw"]=> int(1) ["type"]=> string(7) "unknown" } } } }
Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\webfrontend\index.php:112) in D:\xampp\htdocs\webfrontend\index.php on line 233
 
Laatst bewerkt door een moderator:
Bedankt voor het voorbeeld, ik heb alleen het essentiele gebruikt:
PHP:
$sheet = array(
    "maxrow" => 0,
    "maxcol" => 0,
    "numRows" => 19,
    "numCols" => 7,
    "cells" => array(
        1 => array(
            1 => "gggg",
            2 => "ffff",
            3 => "eeee",
            4 => "dddd",
            5 => "cccc",
            6 => "bbbb",
            7 => "aaaa"
        ),
        2 => array(
            1 => "1",
            2 => "3",
            3 => "1",
            4 => "1",
            5 => "111",
            6 => "2",
            7 => "23"
        ),
        3 => array(
            1 => "2",
            2 => "2",
            3 => "2",
            4 => "1",
            5 => "dfg",
            6 => "dfgdf",
            7 => "fgh"
        ),
        4 => array(
            1 => "3",
            2 => "3",
            3 => "1",
            4 => "3",
            5 => "dfg",
            6 => "dfgdf",
            7 => "asd"
        ),
        5 => array(
            1 => "1",
            2 => "1",
            3 => "3",
            4 => "1",
            5 => "dfg",
            6 => "fd",
            7 => "asd",
        ),
        6 => array(
            1 => "23",
            2 => "d",
            3 => "3",
            4 => "3",
            5 => "dgaa",
            6 => "dfd",
            7 => "dss",
        ),
        7 => array(
            1 => "1",
            2 => "1",
            3 => "2",
            5 => "dfg",
            6 => "dfgdf",
            7 => "fgf",
        ),
        8 => array(
            1 => "123",
            2 => "231",
            3 => "1",
            4 => "4",
            5 => "dfg",
            6 => "sdf",
            7 => "ghj"
        ),
        9 => array(
            1 => "123",
            2 => "a",
            4 => "1",
            5 => "dfg",
            7 => "jhk"
        ),
        10 => array(
            1 => "123",
            2 => "s",
            3 => "1",
            4 => "3",
            5 => "dfg",
            7 => "asd",
        ),
        11 => array(
            1 => "1",
            2 => "d",
            3 => "2",
            4 => "3",
            5 => "dfg",
            6 => "ad",
            7 => "fgh",
        ),
        15 => array(
            1 => "45",
            2 => "65",
            3 => "56",
            4 => "6",
            5 => "4",
            6 => "5",
            7 => "6",
        ),
        19 => array(
            1 => "6",
            2 => "5",
            3 => "4",
            4 => "7",
            5 => "8",
            6 => "5",
            7 => "1",
        ),
    )
);

$fileName = "test";
$query = "INSERT INTO `". $fileName ."` VALUES ";
$values = array();
foreach($sheet['cells'] AS $row) {
    $rowValues = "(0";
    for($i = 1; $i <= $sheet['numCols']; $i++) {
        if(!isset($row[$i])) {
            $rowValues .= ", NULL";
        } else {
            $rowValues .= sprintf(", \"%s\"", $row[$i]);
        }
    }
    $values[] = $rowValues .")";
}
$query .= implode(", ", $values) .";";
var_dump($query);

Kun je hier wat mee?
 
Uhmm, misschien als je wat uitleg erbij wilt geven, want ik importeer niet alleen de voorbeeld sheet, dus dit moet automatisch gaan zoals het nu gaat.
En moet ik dit dan verplaatsen voor me gehele insert into?
 
Je zult jouw gedeelte waarin je de INSERT-query opbouwt moeten vervangen door dit:
PHP:
$query = "INSERT INTO `". $fileName ."` VALUES ";
$values = array();
foreach($sheet['cells'] AS $row) {
    $rowValues = "(0";
    for($i = 1; $i <= $sheet['numCols']; $i++) {
        if(!isset($row[$i])) {
            $rowValues .= ", NULL";
        } else {
            $rowValues .= sprintf(", \"%s\"", $row[$i]);
        }
    }
    $values[] = $rowValues .")";
}
$query .= implode(", ", $values) .";";

$result = mysql_query($query);
if($result == FALSE) {
    die('Error: '. mysql_error());
} else {
    //reload the page index.php when the function is done.
    Header("Location: index.php");
}
 
Hij doet in dat geval precies hetzeflde. Toont nog steeds de witte regels, de values komen er, net zoals mijn verbeterde code, ook goed in ipv 'array'.
 
Dat is niet mogelijk, uit de var_dump wordt duidelijk dat er 19 rijen ($sheet['numRows']) zijn. Van dat aantal zijn er maar 13 ingevuld aangezien de array van $sheet['cells'] 13 waardes bevat. Door middel van de foreach loop ik door die 13 waardes.

Verder zorgt mijn script er voor dat als een kolom binnen de rij leeg is hij de waarde NULL krijgt. Hiermee wordt de foutmelding "Error: Column count doesn't match value count at row x" voorkomen.

Waar gaat het mis? :)
 
Laatst bewerkt:
Ik ga even wat testen, ik denk dat het namelijk komt omdat ik van de PK = 0, er een id atuo_increment van heb gemaakt.. Dus er is wel altijd een waarde nu...
Wellicht als ik dit terug verander doet het het wel..
 
Mijn fout...Nog niet helemaal wakker denk ik..

Ik had de insert into van de column names veranderd...
Nu het goeie gedeelte veranderd en inderdaad het werkt perfect!

Bedankt voor je tijd en moeite :) Ik ga hem neerzetten als opgelost.

De goede code:

PHP:
function sheetData($sheet)
{
	// fill all the rows with data from the excel sheet.
	$fileName = $_POST['name'];
	$x = 2;									
	$query = "INSERT INTO `". $fileName ."` VALUES ";
		$values = array();
		foreach($sheet['cells'] AS $row) {
			$rowValues = "(0";
			for($i = 1; $i <= $sheet['numCols']; $i++) {
				if(!isset($row[$i])) {
					$rowValues .= ", NULL";
				} else {
					$rowValues .= sprintf(", \"%s\"", $row[$i]);
				}
			}
			$values[] = $rowValues .")";
		}
		$query .= implode(", ", $values) .";";
		 
		$result = mysql_query($query);
		if($result == FALSE) {
			die('Error: '. mysql_error());
		} else {
			//reload the page index.php when the function is done.
			Header("Location: index.php");
		}
}
$nr_sheets = count($excel->sheets);       // gets the number of worksheets
$excel_data = '';              // to store data of each sheet
// traverses the number of sheets and sets data in $excel_data
for($i=0; $i<$nr_sheets; $i++)
{
	$excel_data .= sheetData($excel->sheets[0]) .'<br/>';
}


Nogmaals bedankt!
 
Een ding dat ik nog niet begrijp is dat je bij een goed uitgevoerde query een header() gebruikt.

Op regel 32 loop je door diverse sheets heen waarbij je elke keer die query uit laat voeren.
Maar stel $nr_sheets levert 3 op, dan wordt de functie sheetData() 3x uitgevoerd. Alleen zal hij bij de eerste juist uitgevoerde query die header() uit gaan voeren. Alles wat daarna komt binnen je for-lus wordt dan dus genegeerd omdat de gebruiker naar index.php is gestuurd :confused:
 
De eis was om het programma te maken voor 1 sheet.
Dat ik hem naar de index stuur is zodat mijn tabel gedeelte (waar alle tabellen uit de database staan) wordt weergegeven, gelijk update.

Het $nr_sheets heb ik geprobeerd eruit te halen, wonder boven wonder werkt het dan niet meer. Vandaar de oplossen dat ik die standaard de waarde 1 geef.
 
Dus dit:
PHP:
$nr_sheets = count($excel->sheets);       // gets the number of worksheets
$excel_data = '';              // to store data of each sheet
// traverses the number of sheets and sets data in $excel_data
for($i=0; $i<$nr_sheets; $i++)
{
    $excel_data .= sheetData($excel->sheets[0]) .'<br/>';
}
Vervangen door dit:
PHP:
sheetData($excel->sheets[0]);
levert niet hetzelfde resultaat?
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan