note 81223 added to function.mysql-connect
| From: | taalzz at gmail dot com | Date: | Tue, 19 Feb 2008 06:41:59 +0000 |
| Subject: | note 81223 added to function.mysql-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136267@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 69.147.83.197
Probable Submitter: 117.102.58.95
----
Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php
Edit -- https://master.php.net/note/edit/81223
Del: integrated -- https://master.php.net/note/delete/81223/integrated
Del: useless -- https://master.php.net/note/delete/81223/useless
Del: bad code -- https://master.php.net/note/delete/81223/bad+code
Del: spam -- https://master.php.net/note/delete/81223/spam
Del: non-english -- https://master.php.net/note/delete/81223/non-english
Del: in docs -- https://master.php.net/note/delete/81223/in+docs
Del: other reasons-- https://master.php.net/note/delete/81223
Reject -- https://master.php.net/note/reject/81223
Search -- https://master.php.net/manage/user-notes.php