Forum Moderators: coopster
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$id="delete from todo where id='$id'";
mysql_query($id);
mysql_close();
?>
Do you have register globals on or off? And what about short tags?
Try changing your code to:
<?php
include("dbinfo.inc.php");mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");$query="delete from todo where id='".$_GET['id']."' LIMIT 1";
mysql_query($query);mysql_close();
echo "ID " . $_GET['id'] . " deleted!";
?>
You don`t really need to use mysql_close() as the connection is closed anyway once the query ends. I have left in it place though. Also, its not a good idea to name your query variable ($id) the same as your variable that already holds data as it will overwrite it.