Im trying to drop a table from inside PHP so far im using this code
Code: Select all
//Connect to mysql server
$JobLink = mysql_connect(localhost ,$DBuser, $DBpass);
if(!$JobLink) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db($DBname);
if(!$db) {
die("Unable to select database");
}
$id = $_POST['JobID'];
$jobtable = 'job_'.$id.'_q';
$rectable = 'job_'.$id.'_r';
$cantable = 'job_'.$id.'_c';
$qry = "DELETE FROM jobs WHERE id ='$id'";
$result = @mysql_query($qry);
if($result) {
$sql = "DROP TABLE job_2_c";
header("location: ../admin");
exit();
}else {
die("Query failed");
}However the table dosent get dropped, the record from the jobs database gets deleted thou
ANy ideas ?
Thanks in advance