Jump to content

Is This Right $Act==Del?


lovephp

Recommended Posts

guys im trying to add up a action to delete all table if needed else delete row according to id.

 

 

i added

 

if($act==del){

mysql_query("DROP TABLE survey") or die(mysql_error());

}

 

this should execute only if i make the url like del.php?act=del else only the DELETE FROM survey WHERE id = '$id' should work. tell me if its the right way

 

 

<?php
$id =$_REQUEST['id'];    
$user = $login->username;
if($user =='administrator'){
   // sending query
   mysql_query("DELETE FROM survey WHERE id = '$id'")
   or die(mysql_error());    
   header("Location: status.php");
}else{
    header("Location: logout.php");
}
if($act==del){
mysql_query("DROP TABLE survey") or die(mysql_error());    
}

?>

Link to comment
https://forums.phpfreaks.com/topic/270831-is-this-right-actdel/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.