I'm having pretty simple bug but I just can't figure out why it happens.I have this array:
Array
(
[1] => Array
(
[A] => Joakim
[B] => Dzafic
[C] => [email protected]
)
[2] => Array
(
[A] => Jevren
[B] => Jevrej
[C] => [email protected]
)
)
And I'm trying to insert it into my MySQL database table like so:
foreach($sheetData as $rec){
$result=$mysqli->query("INSERT INTO `test`(`name`,`surname`,`email`) VALUES
(
".$rec['A'].",
".$rec['B'].",
".$rec['C']."
);");
if(!$result){
var_dump($result);
die("Something's wrong with query!");
}else{
echo 'Inserted!';
}
}
But it says: Something's wrong with query! and when I do var_dump($result); it says: bool(false)
Please help me to debug this part of code because I'm pretty stuck with it.
foreach($sheetData as $rec){toforeach($sheetData as $key => $rec) {