im wondering if someone could point me in the right direction as im trying to update multiple rows but for some reason everytime time i do the update, variable id_employee is set with the same value for all the rows.. that´s what i figured out when i var_dumped $_POST. The rest of fields are fine.. Here is a complete view of my code. http://pastie.org/5478920, also this is what i get when i var_dump http://pastie.org/5478980
$query = "update project_staff
set
id_employee=?
where
id_project=?
and
id_projectemployee=?
";
$stmt = $this->dbh->prepare($query);
for ($i = 0; $i < count($_POST['id_employee']); $i++){
$employee = $_POST['id_employee'][$i];
$stmt->bindValue(1, $employee, PDO::PARAM_INT);
$stmt->bindValue(2, $_POST["id"], PDO::PARAM_INT);
$stmt->bindValue(3, $_POST["idstaff"], PDO::PARAM_INT);
$stmt->execute();
}
echo("Project" . " " . $_POST["nom"] . " ". "has been updated");
id_employee[]array?