PHP Code:
$cvid = $_GET['cvid'];
$sql_delete_cv = "DELETE FROM cvdb WHERE ID=$cvid";
if (@mysql_query($sql_delete_cv)) {
echo("The CV has been deleted from the database!<br>");
} else {
echo("Error deleting CV:" . mysql_error());
}
Well, the problem is that there is no $_GET["cvip"]. Here's why:
PHP Code:
echo("$cvname | $cvstamp | <a href='editcv.php?id=$cvid'>Edit</a> | <a href='deletecv.php?id=$cvid'>Delete</a><br>");
You should call it as $_GET["id"]
HOWEVER, your system is not safe at all.
You might want to modify your script as follows:
PHP Code:
$cvid = $_GET['id'];
$sql_delete_cv = sprintf("DELETE FROM cvdb WHERE ID='%s'",mysql_escape_string((string) $cvid));
if (@mysql_query($sql_delete_cv)) {
echo("The CV has been deleted from the database!<br>");
} else {
echo("Error deleting CV:" . mysql_error());
}
Or otherwise your script would be open to SQL-injection attacks. Consider reading http://www.sitepoint.com/article/sql...n-attacks-safe.
Bookmarks