Here is my delete.php page:
<?php
//including the database connection file
include("config.php");
//getting id of the data from url
$id = $_GET['id'];
//deleting the row from table
$result = mysqli_query($mysqli, "DELETE FROM users WHERE id=$id");
//redirecting to the display page (index.php in our case)
header("Location:index.php");
?>
and the index.php page that is calling hit has:
<?php
//including the database connection file
include("config.php");
$result = mysqli_query($mysqli, "SELECT * FROM users ORDER BY id ASC");
// using mysqli_query instead
while($res = mysqli_fetch_array($result))
{
?>
<table>
<tr>
<td class="long"><?php echo $res['nameFirst'];?></td>
<td class="long"><?php echo $res['nameLast'];?></td>
<td class="long"><?php echo $res['email'];?></td>
<td><a href="edit.php?id=$res[id]">Edit</a></td>
<td><a href="delete.php?id=$res[id]" onClick="return confirm('Are you sure you want to delete?')">Delete</a></td>
</tr>
<?php } ?>
</table>
But when I click the Delete link, the page asks for confirmation, and then refreshes itself as it reloads index.php (itself) but the row in the table does not delete.
I am sure this is a simple fix but can't see the problem. I am presuming the error is somewhere in the $result line?
Thank you in advance.