Search the Community
Showing results for tags 'drop table'.
-
//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 ?