sinisterguy
-
Posts
4 -
Joined
-
Last visited
Never
Posts posted by sinisterguy
-
-
there, i edited the original post
-
oops, I do have the mysql_query in there just forget to mension in in the post.
-
Hello,
I am attempting a to code a simple php todo list but i'm having a problem deleting records. What happens is this: i link to this url: /delete.php?list_name=$list_name&table=lists and when I try the query below:
delete.php
[code]
<?
mysql_connect("localhost","xxxxxx","xxxxxx");
mysql_select_db("xxxxxxy") or die("Unable to select database.");
$table = $_GET["table"];
$list_name = $_GET["list_name"];
if($table == "lists")
{
$query = "DELETE FROM lists WHERE name='$list_name'";
}
elseif($table == "items");
{
$item_name = $_GET["item_name"];
$query = "DELETE FROM items WHERE item_name='$item_name'";
}
mysql_query($query);
mysql_close;
if($table == 'lists')
{
header("Location: index.php");
}
else
{
header("Location: list.php?list_name=$list_name");
}
?>
[/code]
nothing happens, I'm not even returned any errors. Any suggestions?
EDITED
Delete MySQL records
in PHP Coding Help
Posted
your query statement looks good,
I would echo the query to debug.
[/quote]
thanks for the tip, I fixed it by removing the elseif, it works if I just have the else, but if I test the second condition, it always returns true for some reason.