Currently I am working on adding an edit button into my page that is hooked up to a table. When you click the edit button it is supposed to open a modal. After finishing a bunch of work and trying the same system on a different page I noticed it only works with the first row in the mysql database, the rest of the data doesn’t want to open the modal. I tried both defining the data and leaving it as row data and both are still giving the issue.
There is a bunch of lines so I’m just gonna give the important stuff unless someone needs the other information.
$query = “SELECT * FROM users WHERE blacklisted < ‘1’ ORDER BY id DESC”;
$res = $connect->query($query);
if($res->num_rows > 0):
while($row = $res->fetch_assoc()){
$userid = $row[‘id’];
?>
<td> <a href="#edituser<?php echo $userid; ?>" data-toggle="modal"><button class='btn btn-primary' type='button'>Edit</button></a> </td>
This is the main information for the modal
<div class="modal fade" id="edituser<?php echo $userid; ?>">
I know I kept it to the bare minimum but my code has a very large number of lines for example if statements in the modal that are unnecesary since they technically work