Jump to content

PHP-MySQL: Too many connections


twinklerip

Recommended Posts

A PHP script showed an warning on service (it works well but there was this warning one time). Here it goes:

<b>Warning</b>:  mysql_pconnect() [<a href='function.mysql-pconnect'>function.mysql-pconnect</a>]: Too many connections in <b>/home/www/*address not shown for privacy*/addt.php</b> on line <b>26</b><br /><br /><b>Warning</b>:  mysql_select_db(): supplied argument is not a valid MySQL-Link resource in <b>/home/www/*address not shown for privacy*/addt.php</b> on line <b>27</b><br /><br /><b>Warning</b>:  mysql_query(): supplied argument is not a valid MySQL-Link resource in <b>/home/www/*address not shown for privacy*/addt.php</b> on line <b>30</b><br /><br /><b>Warning</b>:  mysql_fetch_row(): supplied argument is not a valid MySQL result resource in <b>/home/www/*address not shown for privacy*/addt.php</b> on line <b>31</b><br />

What could be the reason for that?One more problem that needs solution. From a form data are sent to a php script by get method, then that script adds the data to the database. If any data contain a apostrophe it is saved in the data base as escape sequence. e.g. "Twinkle's Home" is being saved in the database as "Twinkle\'s Home". When another page retrieves the data from the database it shows "Twinkle\'s Home". How this problem be solved?Thank you.

Link to comment
Share on other sites

HMMM if you say it only happen once i think its a server prob i also experience that erro once.....i think you should use mysql_real_escape_string(); function when retrieving am not sure though.

Link to comment
Share on other sites

What could be the reason for that?
According to the PHP manual
[With mysql_pconnect()], the connection to the SQL server will not be closed when the execution of the script ends [as opposed to mysql_connect()]. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()).
It also states
WarningUsing persistent connections can require a bit of tuning of your Apache and MySQL configurations to ensure that you do not exceed the number of connections allowed by MySQL.
So, you may have to increase the number of connections allowed to your MySQL server. What is wrong with mysql_connect() anyway? Try using that instead.mc_keny is thinking of mysql_close($con), which will close the connection assigned to $con. But that won't work with mysql_pconnect().
When another page retrieves the data from the database it shows "Twinkle\'s Home". How this problem be solved?
stripslashes($string);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...