note 81223 rejected from function.mysql-connect by nlopess
| From: | nlopess@php.net | Date: | Tue, 19 Feb 2008 12:19:43 +0000 |
| Subject: | note 81223 rejected from function.mysql-connect by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-136274@lists.php.net to get a copy of this message | ||
Note Submitter: taalzz at gmail dot com
----
Can someone please help me?
mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
mysql_select_db($CFG['db_name']);
function tag_info() {
$result = mysql_query("SELECT * FROM tags GROUP BY tag_name ORDER BY RAND() DESC");
while($row = mysql_fetch_array($result)) {
$arr[$row['tag_name']] = $row['count'];
}
//ksort($arr);
return $arr;
}
it is generating ... TOO MANY CONNECTIONS error.
There is no mysql_close() used in this code.
Whenever i use mysql_close() it generate strange errors
I tried the following code
$dbi = mysql_connect($db_host, $db_user, $db_pass);
if (!dbi) { die('Could not connect: ' . mysql_error()); }
mysql_select_db($CFG['db_name']);
function tag_info() {
$result = mysql_query("SELECT * FROM tags GROUP BY tag_name ORDER BY RAND() DESC");
while($row = mysql_fetch_array($result)) {
$arr[$row['tag_name']] = $row['count'];
}
//ksort($arr);
return $arr;
}
mysql_close($dbi);
but this code didnt work :( it generate errors!
can anyone tell me whats wrong?