I have a Table that displays titled and first name columns and delete link on the 3rd column.
Unfortunately for a reason i don't understand, records are not deleting when the Delete link is clicked.
Please friends, help me figure out what's wrong here.
Table
<?php
$user_id = $_SESSION["user_id"]; //brought here via
session
//select statement here
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<tr> <td scope="row">' . $row["titled"]. '</td> <td> '.$row["firstname"] .'</td> <td><a href="user_delete.php?
delete=$row[user_id]">Delete</a> </td> </tr>';
}
} else {
echo "0 results";
}
?>
user_delete.php code
<?php
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/soap/includes/server.php';
if(isset($_GET["delete"]) )
{
$user_id = $_GET["delete"];
$sql= "DELETE FROM users WHERE user_id='$user_id'";
$res= mysqli_query($con, $sql) or
die("Failed".mysqli_error($con));
echo "<meta http-equiv='refresh'
content='0;url=user_settings.php'>";
}
?>