hi,
looks as if you tried to do something twice:
$query = [FIRST:] mysql_query("DELETE FROM $tablename WHERE id= $id")or ...
if(![SECOND:]mysql_query($query))
each time you place mysql_query(...) in the code, it is executed!
and at 2nd time, you try to execute $query (which is a flag (true or false) that tells you whether the FIRST query has succeded) instead of the SQL statement.
I assume you intended this:
$query_ok = mysql_query("DELETE ...");
if(!$query_ok)
die("there was an error");
or:
mysql_query("DELETE ...") or die("there was an error");
hope this helps.