i was trying to updating multiple MYSQL rows with one submit button,
before i used to create submit for each row, but since i have a lot of rows now i need to update them all together
index.php
<?php
if (mysqli_num_rows($row){
while($row1= mysqli_fetch_assoc($row){
id<input type="text" value="<?php echo $row["id"];?>" name='id' id="id" >
id<input type="text" value="<?php echo $row["name"];?>" name='name' id="name" >
}
<button type="submit" formaction="update.php">
submit
</button>
}
update.php
$id= $_POST['id'];
$name= $_POST['name'];
$sql = "UPDATE `$tabelname` SET
name='$name'
WHERE id='$id'";
its updating the first row only
if (mysqli_num_rows($row)which will cause a parse error. Is that your actual code or did you accidentally miss the missing bracket? Same forwhile($row1= mysqli_fetch_assoc($row).while($row1< you're using$row1but not using it. You used$row. Plus where and how is$tabelnamedefined?id<inputwhich that will also cause another error, being an undefined constant notice. Your question is unclear.$_POST['id'], it will be from the last row.