I want to expand a query in a foreach loop. I'm doing it without bind_param(), which causes errors, probably because my values include commas which i do not want to remove. I want to Insert multiple rows with one Query. Is there a Way to use bind_param() in this context?
Code now looks like:
$finalquery = "INSERT INTO mytable (a,b) VALUES";
foreach($xml->entry) {
$abc_a = $xml->schema;
$abc_b = $xml->schema->a;
if($count == 1){
$finalquery .= "($abc_a,$abc_b)"
}else($count == 1){
$finalquery .= ",($abc_a,$abc_b)"
}
//COUNT UP
}
$result = $mysqli->query($finalquery) or die ("ERROR: ($finalquery)");
Just keep in mind that when building a query like this, This way i am inserting multiple rows in my single table.