Jump to content

Recommended Posts


//CHECK TO SEE IF TABLE ALREADY EXISTS TO THE DATE
if($TABLE_NAME == $date){


// IF EXISTS THEN DROP THE TABLE
echo 'THIS DATE ALREADY EXISTS <br>';

$drop_table = "DROP TABLE` " .$date."`";


mysql_query($drop_table);


echo '<h4>THE TABLE HAS BEEN DROPPED</h4><h5>NOW SELECT THE FILE YOU WANT TO CREATE</h5>';




}
else{
// CREATE THE NEW TABLE


$create_table = "CREATE TABLE `".$date."` (
 `entry_id` int(11) NOT NULL,
 `transaction_id` varchar(55) NOT NULL,
 `name` varchar(255) character set latin1 default NULL,
 `price` varchar(11) character set latin1 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8";


mysql_query($create_table);
echo 'NEW TABLE HAS BEEN CREATED PLEASE MOVE TO NEXT STEP';


} $run_q = mysql_query($create_table); 


$return =  '<h4>FILE THAT YOU SELECTED:</h4>' . $_FILES['file']['name'];


$file = $_FILES['file']['tmp_name'];


$handle = fopen($file,"r");


while(($fileop = fgetcsv($handle,1000,",")) !== false){


$name   = $fileop[0];
$price   = $fileop[1];
$t_id   = $fileop[2];
$ship_method   = '';
$cc    = '';
$address = '';
$city = '';
$state    = '';
$cc    = '';
$email = '';
$p_name = '';
$p_quantity  = '';
$total = '';
$id = '';
$date = '';

}

I can't seem to get the DROP TABLE query to execute through PHP. It is not a multiple query

 

 

or anything that would create confusion, and when imputed into SQL directly fire correctly.

 

Any suggestions ?

Link to comment
https://forums.phpfreaks.com/topic/287016-drop-table-not-working-in-php/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.