RE: [PHP-DB] What's wrong with this code?
| From: | Brunner, Daniel | Date: | Mon, 26 Mar 2001 15:53:55 +0000 |
| Subject: | RE: [PHP-DB] What's wrong with this code? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-7827@lists.php.net to get a copy of this message | ||
Hello...
Try mysql_pconnect instead....
Dan
> ----------
> From: Emir Musabasic
> Sent: Monday, March 26, 2001 9:34 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] What's wrong with this code?
>
> Hi,
>
> I really need help, I wrote a function so that I can
> call for db user/password in an include file. It looks
> like this:
>
> // Connect to the database
> function db_connect(){
> global $MYSQL_USERNAME, $MYSQL_PASSWORD, $DB,
> $HOST;
> $db =
> mysql_connect("$HOST","$MYSQL_USERNAME","$MYSQL_PASSWORD");
> mysql_select_db("$DB",$db);
> }
>
> I have user/password/host variables inside a config
> file but for some reason when I include this into a
> php page when I test it, I get:
>
> Fatal error: Cannot redeclare db_connect() in
> /www/affiliate/include/functions.inc on line 7.
>
> Am I missing something because everything looks good
> to me.
>
> Emir.
>
> __________________________________________________
> Do You Yahoo!?
> Get email at your own domain with Yahoo! Mail.
> http://personal.mail.yahoo.com/
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>