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

Posted by Jeff North on 07/03/06 13:15

On Sun, 2 Jul 2006 00:18:41 +0200, in alt.php "Samuël van Laere"
<webkluns@hotmail.com>
<c216e$44a6f4b6$d52e1f47$24599@news.chello.nl> wrote:

>| I've been trying to "update" an function I use to something better.
>| Basicly I need to grab all tablenames in a mysql database:
>|
>| function GrabTables($dbname){

mySQL V5.x you should use:
SHOW FULL TABLES FROM $dbname WHERE table_type = 'BASE TABLE'
otherwise SHOW TABLES will also list the Views within the database.

>| $sql = "SHOW TABLES FROM $dbname";
>| $result = mysql_query($sql);
>| while ($row = mysql_fetch_row($result)) {
>| echo "{$row[0]}\n";
>| $tables = array($row[0]);
>| }
>| return $tables;
>| }
>|
>| The echo "{$row[0]}\n"; indeed prints all table names.
>| But I need to pass those as an array to another function.
>| And thats my problem, cause I can't get it to work.
>| $tables doesn't return an array.
>|
>| Any thoughts?
>|
>|
>| Cheers,
>| Samuel
>|
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

 

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

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