So I have a MySqli statement that both the option value columns name are changeable and so is the variables being inserted into the database and it’s saving the second set of values but not the first and was wondering where my for loop is going wrong.
This is the statement:
for($i=0; $i<sizeof($optionname); $i++)
{
$stmt = $mysqli->prepare("INSERT INTO cart (userid, itemno, option".($i+1)."name, option".($i+1)."value) VALUES (?, ?, ?, ?)");
$stmt->bind_param('ssss', $CartID, $PartNo, $optionname[$i], $optionvalue[$i],);
}
$stmt->execute();