note 26620 added to function.mysql-connect
| From: | crypto at notup2u dot net | Date: | Wed, 06 Nov 2002 21:58:57 +0000 |
| Subject: | note 26620 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-39072@lists.php.net to get a copy of this message | ||
Here is a function to get the result of a MySQL query and avoid "any" connection problem.
It is mostly interesting when you need to connect a lot to MySQL as you only have a few MySQL
connections allowed. (Default is 3)
Voici une fonction pour obtenir le résultat d'une requête MySQL et éviter "tout"
problème de connection.
Elle est principalement interressante lorsque vous avez besoin de vous connecter beaucoup au MySQL
et que vous n'avez qu'un nombre limité de connections permises. (3 par défaut)
function get_mysql_query($query,$server, $user_name, $user_pwd, $base_name){
$connection = @mysql_connect($server,$user_name,$user_pwd);
while($connection == FALSE):
$connection = @mysql_connect($server,$user_name,$user_pwd);
endwhile;
$db = @mysql_select_db($base_name, $connection);
$result = @mysql($base_name,$query);
$connection_close = @mysql_close($connection);
return $result;
}
/Crypto
--
http://www.php.net/manual/en/function.mysql-connect.php
http://master.php.net/manage/user-notes.php?action=edit+26620
http://master.php.net/manage/user-notes.php?action=delete+26620
http://master.php.net/manage/user-notes.php?action=reject+26620