[PHP-DB] DB connections ?

2004-07-05 Thread Michael Gale
Hello,

I am designing a web that will require access to a specific database. I am 
also using sessions and am storing the
session data in the database.

So on every page that loads there will be a connection to the mysql server (local) to 
access the session db and tables
and the web app database and tables.

My question is this would make two db connections per page right ? one after another ? 
-- which would not be optimized
??

Would it be better to but the session tables in with the web app tables under a common 
database ?? At first I thought
that it would be more secure if the two where separate.

Any comments ...

Michael.

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



Re: [PHP-DB] DB connections ?

2004-07-05 Thread John W. Holmes
Michael Gale wrote:
I am designing a web that will require access 
 to a specific database. I am also using sessions and
 am storing the session data in the database.
So on every page that loads there will be a connection 
 to the mysql server (local) to access the session db and
 tables and the web app database and tables.
My question is this would make two db connections per page 
 right ? one after another ? -- which would not be optimized
Would it be better to but the session tables in with the web app tables under a 
common database ?? At first I thought
that it would be more secure if the two where separate.
So long as you don't close the connection after you get your session 
data, the next call to mysql_connect() with the same parameters will 
realize there's already a connection open and use that.

Why not have a single include file that connects to your database, 
though? Then include your custom session hanlder which selects its 
database and retrieves the data. Then your main script selects it's 
database and does what it needs to do. Still one connection with less 
confusion.

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] DB Connections

2002-01-31 Thread jas

Ok, I am having a hard time coming up with a mysql connection class that
simply allows me to setup a require(db_connection.inc) at the top of my php
pages that allows a consistent connection to the mysql db and allows
multiple queries thoughout the php page in question.  I have read a few
tutorials on it and as of yet they all seem to go over my head.  If someone
could give me some more insight into this area I would greatly appriciate
it.
Jas



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] DB Connections

2002-01-31 Thread Gurhan Ozen

Jas...
What errors are you getting? What do you have inside your db_connection.inc
file? Do you have the path for db_connection.inc inside the require()
function correct?
  Give us more insights to be able to find out what the problem is..

Gurhan

-Original Message-
From: jas [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 26, 2002 1:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] DB Connections


Ok, I am having a hard time coming up with a mysql connection class that
simply allows me to setup a require(db_connection.inc) at the top of my php
pages that allows a consistent connection to the mysql db and allows
multiple queries thoughout the php page in question.  I have read a few
tutorials on it and as of yet they all seem to go over my head.  If someone
could give me some more insight into this area I would greatly appriciate
it.
Jas



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]