Warning: mysql_connect(): Too many connections in dbconnect
Posted: Mon May 29, 2006 12:23 am
twigletmac | Please use
In my code, i call it like this
After few hours of running this, i recieved this error
Warning: mysql_connect(): Too many connections in dbconnect.php on line 8
Check Servername, User, Password
someone help me out of this
twigletmac | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a dbconnect.php file.
This is the code i have in thatCode: Select all
<?PHP
function exec_query($sql)
{
$server = "localhost";
$username = "root";
$pwd = "Pass";
$db_name = "test";
$link = mysql_connect($server,$username,$pwd) or die ("Check Servername, User, Password");
mysql_select_db($db_name) or die ("Check Databasename");
$result=mysql_query($sql) or die ("Check Query");
mysql_close($link);
return $result;
}
?>Code: Select all
<?PHP
require 'dbconnect.php';
$tmpsql = "Select distinct code from tbl_emp";
$result=exec_query($tmpsql);
while($row=mysql_fetch_array($result))
{
//my code
}
?>Warning: mysql_connect(): Too many connections in dbconnect.php on line 8
Check Servername, User, Password
someone help me out of this
twigletmac | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]