Welcome to WebmasterWorld Guest from 126.96.36.199
Now when its clicked on it deletes the e-mail from the database.
if ($action == "unsubscribe")
$query = "DELETE FROM list WHERE listemail = '$email'";
$result = mysql_query($query);
echo "Account has already been removed!";
Now the problem I have is that if the link is clicked on a second time, when there is no e-mail address in the database, it still displays the emailRemoved() function instead of the echo statement.
I`ve tried (!$result) and (empty($result)) but its still the same.
So how do I get the echo statement to display if theres nothing to delete?
The problem is that a DELETE query always returns TRUE, as long as the query was formally OK. From the PHP manual:
A non-FALSE return value
means that the query was legal and could be executed by
the server. It does not indicate anything about the number of
rows affected or returned. It is perfectly possible for a query
to succeed but affect no rows or return no rows.
, After a DELETE query it returns the number of deleted rows, and obviously 0 if no row has been deleted.