I am trying to delete a row based on the unique user_id. I have done a var_dump($_POST); to verify that I have the proper information. I convert the $_POST variables to $uid, $fn and $ln.
if (isset($_POST['submitted'])) { // Handle the form.
$uid = $_POST['user_id'];
$fn = $_POST['first_name'];
$ln = $_POST['last_name'];
echo $uid; // I see the correct $uid here
} else {
echo 'There was an error. <br /> Please return and select a record for <a href="delete_list.html">deletion</a><br />';
}
$query = "DELETE FROM users_tbl WHERE user_id= '$uid' LIMIT 1";
echo $query; // I see the query with my test $uid
$result = mysql_query($query) or trigger_error("Sorry an error occurred and the account could not be deleted");
I do not get either of the errors I have put in the code. All I get on my page is the dump and the echos I have marked as receiving.
The user_id is the primary key. If I change the WHERE to be primarykey= ‘$uid’ then I the trigger_error, so suspected that using primarykey was not the correct thing in this query.