Can anyone tell the difference between the php functions mysql_connect(),mysql_pconnect() and mysqli_connect()? So that it will be a reference for all with this question.
Can anyone tell the difference between the php functions mysql_connect() , mysql_pconnect() and mysqli_connect()
Share
The difference between
connect()andpconnect(), it is simply like a shop when you entering a shop you will open the door and take your item, come out and close the door. That is calledconnect()in mysql. The connection to the mysql database will be automatically closed when the script terminates.When the door of the shop is already opened and never closed it is called
pconnect(), open a connection withmysql_pconnect(), the connection will not be closed and will “persist” for future use.Read more: http://wiki.answers.com/Q/What_is_the_difference_between_mysql_connect_and_mysql_pconnect_in_PHP#ixzz1xZfVfXzv
difference from mysqli and mysql:
There are different opinions on which connector/extension is faster. Here is a simple guideline that you should follow:
If the MySQL database you are connecting to is <= 4.1.3, then use mysql_connect.
If the MySQL database you are connecting to is > 4.1.3, then use mysqli_connect.
Though you can use mysql_connect with newer versions there are certain functions you cannot access.