[PHP] Database connections

2001-04-01 Thread David Hynes

I'm using PHP on a windows box to access a MySQL database.

I noticed that I do not need to open a database connection before performing
a mysql_db_query().  Is this bad coding ?  Should the database connection
always be made ?  Is this specific to Windows ?

# $databaseConnection = mysql_connect ("localhost", "", "");  ## I don't
seem to need this line, or the last one
mysql_db_query("dbnam", "SQL query");
# mysql_close ($databaseConnection);

Thanks,
David.

---
Fed202 Solutions
www.fed202solutions.com
Mobile : 07779 293368
---


-- 
PHP General 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] Database connections

2001-04-02 Thread Yasuo Ohgaki

You don't have to call mysql_close(). PHP handles cleaning resources when script
execution is ended.

You can set default connection parameters for MySQL in php.ini.
I don't know if you need to call mysql_connect(). (I don't use MySQL :)

Regards,
--
Yasuo Ohgaki


""David Hynes"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm using PHP on a windows box to access a MySQL database.
>
> I noticed that I do not need to open a database connection before performing
> a mysql_db_query().  Is this bad coding ?  Should the database connection
> always be made ?  Is this specific to Windows ?
>
> # $databaseConnection = mysql_connect ("localhost", "", "");  ## I don't
> seem to need this line, or the last one
> mysql_db_query("dbnam", "SQL query");
> # mysql_close ($databaseConnection);
>
> Thanks,
> David.
>
> ---
> Fed202 Solutions
> www.fed202solutions.com
> Mobile : 07779 293368
> ---
>
>
> --
> PHP General 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 General 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 Connections - permanent or something else?

2001-01-16 Thread Sam

Hi, 

I have several web pages that are built with php and mySQL.
I use a new connection for each script. 
Should I be using a permanent connection? Or is there a better way around
this?

Regards,
Sam Rose

-- 
PHP General 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] Database Connections - permanent or something else?

2001-01-16 Thread Ignacio Vazquez-Abrams

On Tue, 16 Jan 2001, Sam wrote:

> Hi,
>
> I have several web pages that are built with php and mySQL.
> I use a new connection for each script.
> Should I be using a permanent connection? Or is there a better way around
> this?
>
> Regards,
> Sam Rose
>

Persistent connections are more efficient in that they don't need to open the
connection each time. Unless you have an overwhelming need to limit concurrent
connections to your MySQL server, you should probably be using persistent
connections.

-- 
Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>


-- 
PHP General 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] Database Connections - permanent or something else?

2001-01-16 Thread mOrP

There's one thing, that I don't understand about permanent connections.

When will they be closed?
I could use a logout-page, but there is no garanty for the use of it.

Any explanation would be appreciated.

mOrP

> -Original Message-
> From: Ignacio Vazquez-Abrams [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 16, 2001 6:17 PM
> To: Sam
> Cc: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
> Subject: Re: [PHP] Database Connections - permanent or something else?
> 
> 
> On Tue, 16 Jan 2001, Sam wrote:
> 
> > Hi,
> >
> > I have several web pages that are built with php and mySQL.
> > I use a new connection for each script.
> > Should I be using a permanent connection? Or is there a better 
> way around
> > this?
> >
> > Regards,
> > Sam Rose
> >
> 
> Persistent connections are more efficient in that they don't need 
> to open the
> connection each time. Unless you have an overwhelming need to 
> limit concurrent
> connections to your MySQL server, you should probably be using persistent
> connections.
> 
> -- 
> Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>
> 
> 
> -- 
> PHP General 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 General 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] Database Connections - permanent or something else?

2001-01-16 Thread Steve Ruby


PHP handles persistent connections by leaving them open
for some other identical connection request. The next request
will check for a free connection.

see
http://www.php.net/manual/en/features.persistent-connections.php

In other words, you don't need to worry about when they are closed
php will handle that for you


mOrP wrote:
> 
> There's one thing, that I don't understand about permanent connections.
> 
> When will they be closed?
> I could use a logout-page, but there is no garanty for the use of it.
> 
> Any explanation would be appreciated.
> 
> mOrP
> 
> > -Original Message-
> > From: Ignacio Vazquez-Abrams [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 16, 2001 6:17 PM
> > To: Sam
> > Cc: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
> > Subject: Re: [PHP] Database Connections - permanent or something else?
> >
> >
> > On Tue, 16 Jan 2001, Sam wrote:
> >
> > > Hi,
> > >
> > > I have several web pages that are built with php and mySQL.
> > > I use a new connection for each script.
> > > Should I be using a permanent connection? Or is there a better
> > way around
> > > this?
> > >
> > > Regards,
> > > Sam Rose
> > >
> >
> > Persistent connections are more efficient in that they don't need
> > to open the
> > connection each time. Unless you have an overwhelming need to
> > limit concurrent
> > connections to your MySQL server, you should probably be using persistent
> > connections.
> >
> > --
> > Ignacio Vazquez-Abrams  <[EMAIL PROTECTED]>
> >
> >
> > --
> > PHP General 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]
> >
> 
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-- 
PHP General 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]