You are here: Re: Passing table names « All PHP « IT news, forums, messages
Re: Passing table names

Posted by -Lost on 07/03/06 07:25

function list_tables($db_name)
{
$query = 'SHOW TABLES FROM ' . $db_name;
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
return $tables;
}

Firstly, you do not need to initialize a variable as an array (it is good coding practice
however). Secondly, instead of incurring the overhead of calling the array_push method,
you can simply use the $array[] = 'element'; technique.

Not sure why J.O. Aho thought that the first index would be empty, but oh well.

Also, mysql_list_tables still exists, but is deprecated.

-Lost

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация