Database Err: SQLSTATE[42000] [1203] User shangpu already has more than 'max_user_connections' active connections
- D:\wwwroot\shangpu\wwwroot\protected\include\core.php on line 352
347.
{
348.
if($force_replace || empty($GLOBALS['instance']['mysql'][$db_config_key]))
349.
{
350.
try{
351.
$GLOBALS['instance']['mysql'][$db_config_key] = new PDO('mysql:dbname='.$db_config['MYSQL_DB'].';host='.$db_config['MYSQL_HOST'].';port='.$db_config['MYSQL_PORT'], $db_config['MYSQL_USER'], $db_config['MYSQL_PASS'], array(PDO::MYSQL_ATTR_INIT_COMMAND=>'SET NAMES \''.$db_config['MYSQL_CHARSET'].'\''));
352.
353.
}catch(PDOException $e){err('Database Err: '.$e->getMessage());}
}
354.
return $GLOBALS['instance']['mysql'][$db_config_key];
355.
}
356.
357.
private function _where($conditions)
- D:\wwwroot\shangpu\wwwroot\protected\include\core.php on line 334
329.
$slave_key = array_rand($GLOBALS['mysql']['MYSQL_SLAVE']);
330.
$sth = $this->db_instance($GLOBALS['mysql']['MYSQL_SLAVE'][$slave_key], 'slave_'.$slave_key)->prepare($sql);
331.
}
332.
else
333.
{
334.
335.
$sth = $this->db_instance($GLOBALS['mysql'], 'master')->prepare($sql);
}
336.
337.
if(is_array($params) && !empty($params))
338.
{
339.
foreach($params as $k=>&$v) $sth->bindParam($k, $v);
- D:\wwwroot\shangpu\wwwroot\protected\include\core.php on line 233
228.
}
229.
230.
public function incr($conditions, $field, $optval = 1)
231.
{
232.
$conditions = $this->_where( $conditions );
233.
234.
return $this->execute("UPDATE ".$this->table_name." SET `{$field}` = `{$field}` + :M_INCR_VAL ".$conditions["_where"], $conditions["_bindParams"] + array(":M_INCR_VAL" => $optval));
}
235.
236.
public function decr($conditions, $field, $optval = 1){return $this->incr($conditions, $field, - $optval);}
237.
238.
public function delete($conditions)
- D:\wwwroot\shangpu\wwwroot\protected\controller\goods_controller.php on line 15
10.
}
11.
12.
$condition = array('goods_id' => $id);
13.
$goods_model = new goods_model();
14.
15.
16.
$goods_model -> incr($condition,'views');
17.
if($goods = $goods_model->find($condition))
18.
{
19.
$cate_model = new goods_cate_model();
20.
$this->breadcrumbs = $cate_model->breadcrumbs($goods['cate_id']);
- D:\wwwroot\shangpu\wwwroot\protected\include\core.php on line 87
82.
$action_name = 'action_'.$__action;
83.
if(!class_exists($controller_name, true)) err("Err: Controller '$controller_name' is not exists!");
84.
$controller_obj = new $controller_name();
85.
if(!method_exists($controller_obj, $action_name)) err("Err: Method '$action_name' of '$controller_name' is not exists!");
86.
87.
88.
$controller_obj->$action_name();
89.
function url($c = 'main', $a = 'index', $param = array()) {
90.
if(is_array($c)) {
91.
$param = $c;
92.
if(isset($param['m'])) $m = $param['m']; unset($param['m']);
- D:\wwwroot\shangpu\wwwroot\index.php on line 5
1.
<?php
2.
define('APP_DIR', realpath('./'));
3.
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
4.
define('INCL_DIR', APP_DIR.DS.'protected'.DS.'include');
5.
require(INCL_DIR.DS.'core.php');