![]() |
|
#1
|
|||
|
|||
well help pls... mysql // list databases php!well this is my problem!
<?php $host = "*****"; $user = "*****"; $pass = "*****"; $link = mysql_pconnect($host, $user, $pass); $db_list = mysql_list_dbs( $link ); while ($row = mysql_fetch_object( $db_list )) echo $row->Database; mysql_close($link); ?> okej thats nice... now to output? ------------------------------ test ------------------------------ Argh |
|
#2
|
|||
|
|||
|
Quote:
Firstly I don't think you want to be using a permanent connection, which is created in the line: $link = mysql_pconnect($host, $user, $pass); I'm assuming this because your trying to close the connection with mysql_close, and this is not possible when you've made a permanent connection. Use mysql_connect instead. After that I'm a bit lost on what you want to do? Do you want to retrieve the data in all databases ? Well you could store the names of your databases into an array i.e $dbnames[] = $row->Database; You could then perform a select query on each of the databases: foreach ($dbnames As $dbname) { $result = msql_query("SELECT * FROM $dbname"); while($tmp = mysql_fetch_row($result)) dump data } For a more elequent way to retrieve the data from a mysql_fetch_row, check out the comments at: http://uk.php.net/manual/en/function...-fetch-row.php. Hope this helps. Added later: I was thinking of mysql_fetch_array($result, MYSQL_NUM) syntax rather than mysql_fetch_row. |
|
#3
|
||||
|
||||
|
There's a glaring typo (or two) in your example code; so your first attempt should be to fix that...
PHP Code:
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#4
|
||||
|
||||
|
Sorry JdS..
but there is nothing wrong with that code http://www.php.net/manual/en/control...ures.while.php Quote:
|
|
#5
|
|||
|
|||
|
Quote:
If the code inside a while loop, if statement, for loop etc... is a one liner, then that code will run as far as i'm aware? |
|
#6
|
||||
|
||||
|
Yes, I realised that as soon as I was redirected to the thread; since the message went in an email; I said f'it!
This is why I SHOULD refrain from replying to code issues when I am rushing __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
Recent GIDBlog
Python ebook by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FREE 25 MB, No Ads, Control Panel, ASP, ColdFusion, PHP, MySQL, Access Hosting | rkmails | Free Web Hosting | 0 | 08-Sep-2003 06:49 |
| 600MB Space, 20GB Banwidth, PHP, MySQL, CGI, SSH, FrontPage, FTP, POP3, Web Mail | fcolor | Web Hosting Advertisements & Offers | 0 | 08-Aug-2003 11:11 |
| [script] Password Protect web pages/site using PHP and MySQL | JdS | PHP Code Library | 0 | 23-Jul-2003 11:02 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 14:54 |
| Free Web Hosting: No Ads / Banners +FTP +PHP +MySQL +CGI | JdS | Free Web Hosting | 5 | 26-May-2003 03:36 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The