Re: phpWeather Feature Request
Brought to you by:
iridium
From: Martin G. <gim...@gi...> - 2004-02-09 00:57:09
|
Phil Pierotti <phi...@sw...> writes: Hi Phil, it's nice with all your feedback! > From what I can tell, once you configure phpWeather to talk to MySQL, > it will make its own connection to the database. Yes, it calls mysql_connect or mysql_pconnect in the connect method in file db/pw_db_mysql.php. > However in the process of generating my page, I already initiate a > connection to the database. > > Is there any *really simple* way I can pass these details to > phpWeather for it to use? Assuming, of course, that phpWeather won't > blithely go and close the pre-existing connection once it's done > with it. If you're worried about having two open links to MySQL at the same time, then there's no problem, the PHP manual says: If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned. If you're annoyed about having your password spread across several files, then the easiest solution is to make your defaults.php file reference the password as a variable: /* db_password */ $this->properties['db_password'] = $GLOBALS['password']; and then make sure that $password is in the global scope. And finally, there is a disconnect method in all the database backends, but it isn't used at the moment, and I don't think that will change, it's just there for completeness. -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather: Shows the current weather on your webpage and PHP Shell: A telnet-connection (almost :-) in a PHP page. |