Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/tsl.co.th/public_html/libs/connect.php on line 4
Not connected : Too many connections
ช่วยด้วยครับมันขึ้นข้อความแบบนี้อะครับ ต้องแก้ไขยังไง ขอแบบละเอียดหน่อยครับ งง รีสตาร์แล้ว เว็บเปิดได้ พอมีคนเข้ามาดูสักปริมาณนึง หน้าเว็บก็ขึ้น แบบนี้ แล้วก็เข้าไม่ได้ ครับ
ขอบคุณ
อันนี้ code ของ connect.php
<?
function open_db()
{
$conn = mysql_connect(DB_SERVER,DB_USER,DB_PWD);
if (!$conn)
die('Not connected : ' . mysql_error());
$db_selected = mysql_select_db(DB_NAME,$conn);
if (!$db_selected)
die ('Can\'t use '.DB_NAME.': ' . mysql_error());
mysql_query("set names utf8");
require_once("db.class.php");
return $conn;
}
function close_db($conn)
{
if($conn!=null) {
mysql_close($conn);
}
}
function to_valid_sql($sql)
{
if ($_SERVER["SERVER_NAME"]=="localhost") {
$valid_sql = str_replace("'","''",$sql);
}
else {
$valid_sql = $sql;
}
return $valid_sql;
}
function to_valid_fload($sql)
{
$valid_sql = str_replace(",","",$sql);
return $valid_sql;
}
function convert_post_data($value)
{
if ($_SERVER["SERVER_NAME"]=="localhost") {
$convert_data = $value;
}
else
{
$convert_data = str_replace("\'","'",$value);
$convert_data = str_replace("\\\\","\\",$convert_data);
}
}
function convert_html_data($value)
{
$convert_data = htmlspecialchars($value); //Convertfrom html to character
return $convert_data;
}
function convert_date($value)
{
if($value!='' and $value!='0000-00-00') {
$val = new date_format($value);
$value = $val->convert_format('dmy','/');
} else {
$value = '';
}
return $value;
}
function convert_read_date($value,$type)
{
if($value!='' and $value!='0000-00-00') {
$val = new date_format($value);
$value = $val->read_date($type);
} else {
$value = '';
}
return $value;
}
function convert_basedate($value)
{
if($value!='') {
$val = new date_format($value,'onlyday');
$value = $val->datetime;
} else {
$value = '';
}
return $value;
}
function convert_nowdate()
{
$val = new date_format('','');
$value = $val->pdate;
return $value;
}
function convert_nowyear()
{
$val = new date_format('','');
$value = $val->year;
return $value;
}
function convert_nowtimestemp($value,$type)
{
if($type=='1') { // date
$val = new date_format($value,'onlyday');
$value = $val->time_stamp;
} elseif($type=='2') { // datetime
$val = new date_format($value,'mysql');
$value = $val->time_stamp;
} else {
$val = new date_format('','');
$value = $val->time_stamp;
}
return $value;
}
function txt_process($process)
{
switch ($process)
{
case 1:
$msg = 'The information has been saved. <a href="'.$PHP_SELF.'">Add More</a>';
break;
case 2:
$msg = 'The information has been updated.';
break;
case 3:
$msg = 'The information has been deleted.';
break;
case 4:
$msg = 'The information can not be deleted, Because Associated with each of the data.';
break;
case 5:
$msg = 'File has been uploaded.';
break;
case 6:
$msg = 'File cannot copy to server.';
break;
case 7:
$msg = 'Incorrect file format.';
break;
case 8:
$msg = 'File not found.';
break;
case 9:
$msg = ' The information has been added to the stock.';
break;
case 10:
$msg = ' The information has been canceled.';
break;
case 0:
$msg = '';
break;
}
return $msg;
}
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
ขอความช่วยเหลือครับ mysql_connect() [function.mysql-connect]
Moderators: mindphp, ผู้ดูแลกระดาน
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'admin
by วิทวัส » 13/03/2011 4:53 am » in Programming - PHP - 5 Replies
- 5799 Views
-
Last post by วิทวัส
15/03/2011 3:13 pm
-
-
-
เจอปัญหา Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) [2002] บน FreeBSD
by mindphp » 23/07/2017 3:08 am » in Linux - Web Server - 1 Replies
- 1173 Views
-
Last post by mindphp
23/07/2017 3:20 am
-
-
- 1 Replies
- 8007 Views
-
Last post by Smoanaking
16/03/2015 10:29 am
-
- 10 Replies
- 4467 Views
-
Last post by sunzandesign
19/09/2012 9:17 pm
-
-
ช่วยหน่อยครับ OperationalError:Can't connect to MySQL server
by benzines » 29/11/2012 11:10 am » in Programming - C/C++ & java & Python - 6 Replies
- 5584 Views
-
Last post by benzines
30/11/2012 12:46 pm
-
-
-
ช่วยด้วยค่ะ ขึ้น phpMyAdmin tried to connect to the MySQL server
by pompam » 21/02/2012 11:30 am » in Programming - PHP - 5 Replies
- 2795 Views
-
Last post by tohkai_php
10/04/2012 9:25 am
-
-
-
Database connection error (2): Could not connect to MySQL. Joomla 2.5
by mindphp » 01/02/2012 12:48 pm » in ปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS, CRM - 4 Replies
- 4368 Views
-
Last post by mindphp
09/07/2012 3:11 pm
-
Who is online
Users browsing this forum: No registered users and 10 guests