Mostly a matter of preference I would say.

Cheers,
Rob.

On Fri, 2003-09-26 at 16:10, Daevid Vincent wrote:
> I sent this to php-db with no reply, so I'll try it here then...
>  
> 
> -----Original Message-----
> From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 24, 2003 4:21 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] What is the proper way to use mysql db on a multipage
> site?
> 
> 
> I've been coding with PHP and mySQL for years. And this part has never sat
> right with me and finally I'm getting the nerve to ask how the pros out
> there do this...
> 
> What I do is have a "db.php" file that contains:
> 
> $db = mysql_connect ("localhost","username","password") 
>               or die ("Could not connect to SQL server.");
> mysql_select_db ("mydb",$db) 
>               or die ("Could not select Database");
> 
> 
> Then at the top of every page, I require_once("db.php");
> 
> But it just seems so wasteful to keep making that mysql_connect().
> 
> Isn't there a way to store the $db result so I don't have to keep
> connecting.
> And how about the mysql_select_db() part too? Since I'm going to stay in the
> same db most of the time.
> 
> I thought I read that I can't use a $_SESSION for it, and that's the only
> way I know of to have it be available on each page?
> 
> 
> Daevid Vincent
> http://daevid.com
>  
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to