TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   why do not p in mysql_connect work? (http://www.talkphp.com/general/3017-why-do-not-p-mysql_connect-work.html)

codefreek 06-27-2008 12:36 PM

why do not p in mysql_connect work?
 
i get Fatal error: Call to undefined function pmysql_connect() on line 6

$connection = mysql_pconnect('localhost', 'name', 'pass');

Why do i get the error?..

EDIT: lol i put in the wrong place xD

Orc 06-27-2008 02:51 PM

Quote:

Originally Posted by codefreek (Post 16094)
i get Fatal error: Call to undefined function pmysql_connect() on line 6

$connection = mysql_pconnect('localhost', 'name', 'pass');

Why do i get the error?..

EDIT: lol i put in the wrong place xD

That function means connected persistantly, as I do not understand it between the normal function.

sketchMedia 06-27-2008 03:07 PM

Basically there are some major differences:
  1. mysql_pconnect creates a 'persistent' connection therefore the link to the database is always open, mysql_connect however isnt like that and its links are closed when the script finishes and therefore must be reopened.
  2. mysql_pconnect searches for exisiting persistent connections ans re-uses them if they are found, mysql_connect on the other hand, does not.
  3. Links created with mysql_pconnect cannot be closed with mysql_close

xenon 06-27-2008 07:05 PM

You are wrong about #2.

Quote:

Originally Posted by php.net
mysql_connect description on php.net:

Opens or reuses a connection to a MySQL server.


codefreek 06-27-2008 07:17 PM

Guys, i know what it do that's why i am using it ;)
but thank you ;)

sketchMedia 06-28-2008 01:56 PM

Quote:

You are wrong about #2.
I dont think i am, i am fully aware that mysql_connect reuses a connection, but i was referring to the connections after the page has finished executing (known as persistent) that are still open. Logically if you open a connection with mysql_connect when the code finishes it closes the connection as it isn't persistent, therefore if you then run he script again it must create a new connection thus my statement is correct. Notice that the manual also says:
" If a second call is made to mysql_connect() " indicting a call to this function in the same script execution.


All times are GMT. The time now is 08:52 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0