Warning: mysql_close(): no MySQL-Link resource supplied in /home/blu/public_html/folder/delete.php on line 31. Thanks in advance.
Here is my code:
Code: Select all
session_start();
if (isset($_SESSION['username']) && ($_SESSION['password'])) {
print "Welcome to the Admin Centre!";
require "config.php";
$query = "DELETE FROM diary_contents WHERE id LIMIT 1";
$r = mysql_query ($query);
if (mysql_affected_rows() == 1) {
print '<p>The diary entry has been deleted. <a href=diary.php>Click here</a> to continue.</p>';
} else {
print "<p>Could not delete the entry because: <b>" . mysql_error() . "</b>. The query was $query.</p>";
}
} else {
print "You are not logged in. Please <a href=login.php>click here</a> to login.";
}
mysql_close(); // line 31
ob_end_flush();