You would then loop over $_POST['foo'] where the keys will be the original room number and the value will be an array of the numberRoom and stateRoom values. Each iteration over foo will require a new UPDATE query.
update multirows
Moderator: General Moderators
Thank you very much for your try
I have done this
page2.php
Did you think that?
I have done this
page2.php
Code: Select all
print_r($_POST['foo']);
foreach ($_POST['foo'] as $key => $value) {
list($new_number_room, $new_state_room) = $value;
$query = "UPDATE room p SET p.number_room = '$new_number_room',
p.state_room = '$new_state_room' WHERE p.id_numberRoom = $key";
mysql_query($query) or die(mysql_error());
}