PHP / Query trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello folks,
Trying to grab all tables available in a database and optimize them.
The following code , or rather query is being trouble-some and i am out of ideas.


#--> If submitted
if($_GET['method']=="optimize")
{

#--> Set to array
$allTables = mysql_query("SHOW TABLES");
if(!$query){ print mysql_error(); }
while($table = mysql_fetch_assoc($allTables))
#for($i = 0; $tableName = mysql_fetch_array($allTables);)
{
#--> Walk that array
foreach($table as $dbName => $tableName)
{
   #--> Optimize query
   $optimizeTableQuery = mysql_query("OPTIMIZE TABLE '".$tableName."'");
   if(!$optimizeTableQuery){ print mysql_error(); }
} }
}



anyone?

- Jimmie

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux