Hi, i'm having probs deleting from a database, here is my code.
<?
session_start();
if(!session_is_registered("member_id"))
{
header("Location: ../index.php");
}
$dir = $_SESSION['member_id'];
switch($remove)
{
case 1:
$delete_file = $HTTP_GET_VARS['file'];
$url = "http://www.domain.com/pictures/members/$dir/$delete_file";
unlink ("/home/httpd/vhosts/domain/httpdocs/pictures/members/$dir/$delete_file");
$db = mysql_connect("localhost","username","password");
mysql_select_db("database",$db);
$sql = "DELETE FROM links WHERE link = $url";
$result = mysql_query($sql);
default:
?>
<html>
<head>
</head>
<body>
<a href='index.php?remove=1&file="picture.gif"'><img src='delete.gif' border='0'></a></td></tr>";
</body>
</html>
So what it is supposed to do is go to switch case 1 delete the file picture.gif and delete the link to it from the database. Yet, it's deleting the file fine, just not deleting the link from the database.
Anyone able to figure this one out? I usually have a typo so its always good for someone else to check the code after i've been staring at it for hours! 🙂
Ant