Three Part Question

A

Anonymous

Guest
I actually have three questions, all regarding to PHP & mySQL, but three different areas. This could be three seperate topics, but I figured that posting all at once would make things a little easier for everyone.

QUESTION 1:
---------------
Upon reading the manual, I cannot find a difference between mysql_connect() and mysql_pconnect() other than that pconnect opens up a "persistant" connection. What does that mean? Whats the difference between opening a "regular" connection and a "persistant" connection?

QUESTON 2:
--------------
When accessing a mysql database, and using information from different tables within many different functions across different files; would it be better to have one global connection and declare the resource global in each function or open/close the database as needed per function. I would think that one global variable would do it, but does that pose any drawbacks?

QUESTION 3:
---------------
I dont remember if I have asked this question before or not, but im still having problems so ill ask again. My apoligies if this is a repost. I have a call to mysql_query() and the " or die(mysql_error());" clause at the end of it. Now, the script does stop, however, it does not output an error. I have outputted the sql statement, and it is valid (or at least as far as I can see). I do pass in a globally declared connection resource (which works throughout other query calls). How can I figure out the cause of the problem with no error message?

Sorry for the mix of questions, but I got kinda confused and could not find the information I was looking for inside of the manual or on the net. Thanks for any help in advance.

Will
 
elitecodex said:
I actually have three questions, all regarding to PHP & mySQL, but three different areas. This could be three seperate topics, but I figured that posting all at once would make things a little easier for everyone.

QUESTION 1:
---------------
Upon reading the manual, I cannot find a difference between mysql_connect() and mysql_pconnect() other than that pconnect opens up a "persistant" connection. What does that mean? Whats the difference between opening a "regular" connection and a "persistant" connection?

QUESTON 2:
--------------
When accessing a mysql database, and using information from different tables within many different functions across different files; would it be better to have one global connection and declare the resource global in each function or open/close the database as needed per function. I would think that one global variable would do it, but does that pose any drawbacks?

QUESTION 3:
---------------
I dont remember if I have asked this question before or not, but im still having problems so ill ask again. My apoligies if this is a repost. I have a call to mysql_query() and the " or die(mysql_error());" clause at the end of it. Now, the script does stop, however, it does not output an error. I have outputted the sql statement, and it is valid (or at least as far as I can see). I do pass in a globally declared connection resource (which works throughout other query calls). How can I figure out the cause of the problem with no error message?

Sorry for the mix of questions, but I got kinda confused and could not find the information I was looking for inside of the manual or on the net. Thanks for any help in advance.

Will
Hi Will!
I'm not sure, but I'm try answer at your's question:
1
Your asked what different between mysql_connect() and mysql_connect(). That's very simple:
Than you using mysql_connect() in php script you connect to DB and terminate this connection after script finished. In mysql_pcconnect() after end script connection not terminate. It's create for high speed than mach more peaple using your site.
2
You can (if you want) create class, or use checking workin class for manage connection and operate records.
3
This most best use than you connecting to DB not to query.Why???
 
Back
Top