public function count($table, $conditions = array())
{
$key = getmypid();
$params = array();
$where = empty($conditions) ? '' : self::biuldMultiWhere($conditions, $params);
$count_sql = implode(" ", array('SELECT COUNT(*) AS total_num FROM', 'zh_' . $table, $where));
// echo "count_sql" . $count_sql . "\n";
$stmt = $this->pdo->prepare($count_sql);
$this->bind($params, $stmt);
$result = $stmt->execute();
if ($result === false) {
var_dump("count error, args " . json_encode(func_get_args()));
return false;
}
$count = $stmt->fetch(PDO::FETCH_ASSOC);
$count = isset($count['total_num']) ? $count['total_num'] : 0;
return intval($count);
}