Page 1 of 1
Problems with deleteing a row and a table
Posted: Sun Jul 23, 2006 12:32 am
by HomerTheDragoon
Code: Select all
///remove clan///
if ($mode=="suremoveclan" && is_admin($admin)){
$clan=$_POST['clan'];
$division=$_POST['division'];
$query="DELETE FROM leaguestats_clan_$division WHERE clantag='$clan'";
mysql_query($query);
$query2="DROP TABLE leaguestats_$clan";
mysql_query($query2);
}///end remove clan///
Not sure whats wrong with either of them, but they dont work.
Posted: Sun Jul 23, 2006 12:15 pm
by bdlang
Add some error handling, display the exact query being sent to the database, e.g.
Code: Select all
// are you sure these values are correct and the code block is executed at all?
// note a slight change in your conditional, just my preference
if ( ($mode=="suremoveclan") && is_admin($admin) ){
// are you certain these POST vars exist and are valid?
// use var_dump($_POST) in your script someplace
$clan=$_POST['clan'];
$division=$_POST['division'];
$query="DELETE FROM leaguestats_clan_$division WHERE clantag='$clan'";
mysql_query($query)
OR die("Query 1 error:<br />{$query}<br />" .mysql_error());
// does your user have permission to drop the table?
$query2="DROP TABLE leaguestats_$clan";
mysql_query($query2)
OR die("Query 2 error:<br />{$query2}<br />" .mysql_error());
}