I have had some developers do a search engine for me where they supposedly produce temp tables to sort keywords, only the temp tables are not temporary! So I had to delete some 3000 tables from a database that was 3GB!
How do I make these tables temporary??? I tried to use the TEMPORARY command, but it creates a table doesn't exist error. Running MySQL 3.23.51-Max.
Here's the code that creates the temp (?) tables:
// create temp table if it doesn't exist
$temptable1="ostemp1".$osisid;
$temptable2="ostemp2".$osisid;
if (!$s)
{
$createTempTable1 = "CREATE TABLE IF NOT EXISTS ".$temptable1." ( photoid int(11) NOT NULL default '0',collectionid int(11) NOT NULL default '0',keyword varchar(255) NOT NULL default '',KEY keyword (keyword)) TYPE=MyISAM;";
$createTempTable2 = "CREATE TABLE IF NOT EXISTS ".$temptable2." ( photoid int(11) NOT NULL default '0',collectionid int(11) NOT NULL default '0',keyword varchar(255) NOT NULL default '',KEY keyword (keyword)) TYPE=MyISAM;";
DBquery($createTempTable1); // create the temptable1
DBquery($createTempTable2); // create the temptable1
DBquery("delete from ".$temptable1); // empty temptable
DBquery("delete from ".$temptable2); // empty temptable
Should I use DROP TABLE somewhere? At the end of the search when the data is transferred to the dispaly page or at the end of session? If so how do I do that?
Thanks, Tim