当前位置: 首页>>代码示例>>PHP>>正文


PHP parse_db_error函数代码示例

本文整理汇总了PHP中parse_db_error函数的典型用法代码示例。如果您正苦于以下问题:PHP parse_db_error函数的具体用法?PHP parse_db_error怎么用?PHP parse_db_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了parse_db_error函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Add

 /**
  * Добавить новые теги
  * 
  * 
  * @param array $tags Теги [тег1,тег2,...]
  * @return array Записанные результаты
  */
 function Add($tags)
 {
     global $DB;
     foreach ($tags as $ikey => $value) {
         if (!$value) {
             continue;
         }
         $sql = "SELECT inserttag('" . change_q_new(substr(trim($value), 0, 20)) . "');";
         $tag[] = $DB->val($sql);
         $error[1] = parse_db_error($DB->error);
     }
     return $tag;
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:20,代码来源:tags.php

示例2: GetThread

 /**
  * Выборка тем сообщений
  *
  * @param integer $item_id  ИД треда
  * @param string  $error    Возвращает сообщения об ошибке
  */
 function GetThread($item_id, &$error)
 {
     global $DB;
     $curname = get_class($this);
     $sql = "SELECT id, fromuser_id, reply_to, post_time, msgtext, attach, title, uname, usurname, users.is_banned, login, photo, is_pro_test, role, modified, modified_id, deluser_id, deleted, small, payed, sign\n\t\tFROM \n\t\t(SELECT {$curname}.item_id, {$curname}.fromuser_id, {$curname}.id, {$curname}.reply_to, {$curname}.post_time, {$curname}.msgtext, {$curname}.attach, {$curname}.title, {$curname}.modified, \n\t\t{$curname}.small, 1 as t, modified_id, deluser_id, deleted, NULL as sign FROM {$curname} WHERE item_id = ?i\n\t\tUNION ALL \n\t\tSELECT id, 0, 0, NULL, NULL, short, NULL, title, NULL, NULL, 0, NULL, NULL, NULL, sign\n\t\tFROM articles WHERE id = ?i) as blg\n\t\tLEFT JOIN users ON fromuser_id=uid \n\t\tLEFT JOIN (SELECT DISTINCT from_id, payed FROM orders \n             WHERE payed=true AND from_date<=now() AND from_date+to_date+COALESCE(freeze_to, '0')::interval >= now() AND orders.active='true'\n             AND NOT (freeze_from_time IS NOT NULL AND NOW() >= freeze_from_time::date AND NOW() < freeze_to_time)) as pay\n\t\t ON pay.from_id=uid\n\t\tORDER BY blg.t, reply_to, post_time";
     $this->thread = $DB->rows($sql, $item_id, $item_id);
     $error .= $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $this->msg_num = count($this->thread);
         if ($this->msg_num > 0) {
             $this->SetVars(0);
         }
     }
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:22,代码来源:blogs_articles.php

示例3: GetThread

 /**
  * Выборка тем сообщений.
  *
  * @todo Возвращает несуществующие переменные, проверить и удалить
  * 
  * @param integer $nrsk_id ИД треда
  * @param mixed   $error   Возвращает сообщение об ошибке
  *
  * @return array
  */
 public function GetThread($nrsk_id, &$error)
 {
     global $DB;
     $curname = get_class($this);
     $sql = "SELECT id, fromuser_id, reply_to, post_time, msgtext, attach, title, uname, usurname, login, photo, role, modified, modified_id, deluser_id, deleted, small, is_pro as payed\n\t\tFROM  {$curname}\n\t\tLEFT JOIN users ON fromuser_id=uid \n\t\tWHERE item_id=?i ORDER BY reply_to, post_time";
     $this->thread = $DB->rows($sql, $nrsk_id);
     $error .= $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $this->msg_num = count($this->thread);
         if ($this->msg_num > 0) {
             $this->SetVars($this->msg_num - 1);
         }
     }
     return array($name, $id_gr, 101);
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:27,代码来源:blogs_tray.php

示例4: GetThread

 /**
  * Выборка треда сообщения
  *
  * @param string $error  Возвращает сообщение об ошибке
  * @return integer 0;
  */
 function GetThread(&$error)
 {
     $curname = get_class($this);
     global $DB;
     $sql = "SELECT id, fromuser_id, reply_to, post_time, msgtext, attach, title, uname, usurname, login, photo, role, modified, modified_id, deluser_id, deleted, small, is_pro as payed\n\t\tFROM  {$curname}\n\t\tLEFT JOIN users ON fromuser_id=uid \n\t\tORDER BY reply_to, post_time";
     $res = $DB->squery($sql);
     $error .= pg_errormessage();
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $this->thread = pg_fetch_all($res);
         $this->msg_num = pg_num_rows($res);
         if ($this->msg_num > 0) {
             $this->SetVars($this->msg_num - 1);
         }
     }
     return 0;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:24,代码来源:blogs_payed.php

示例5: getTopAuthors

 /**
  * Популярные авторы.
  *
  * @param integer $limit
  *
  * @return <type>
  */
 public function getTopAuthors($limit = 12)
 {
     global $DB;
     $sql = 'SELECT u.login, u.photo, SUM(a.view_cnt) as viewcnt FROM
             articles_new a
             INNER JOIN users as u ON u.uid = a.user_id
             WHERE a.approved = TRUE
             GROUP BY a.user_id, u.login, u.photo ORDER BY viewcnt DESC LIMIT ?i';
     $ret = $DB->rows($sql, $limit);
     $error = $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     }
     return $ret;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:22,代码来源:articles.php

示例6: Delete

 /**
  * Удалить новость
  *
  * @param integer $id Ид новости
  * @return string Сообщение об ошибке
  */
 function Delete($id)
 {
     global $DB;
     $DB->query('DELETE FROM news WHERE id = ?', $id);
     if ($DB->error) {
         $error = parse_db_error($DB->error);
     }
     return $error;
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:15,代码来源:news.php

示例7: GetAdditInfo

 /**
  * Информация о рейтинге работадателя и кол-ве хитов на его страницу.
  *
  * @param    string   $login   login работадателя
  * @param    string   $err     возвращает возможную ошибку
  *
  * @return   array             массив с данными
  */
 public function GetAdditInfo($login, &$err)
 {
     global $DB;
     $ret = $DB->row('
         SELECT 
             hits, 
             rating_get(rating, is_pro, is_verify) as rating, 
             hitstoday 
         FROM employer 
         WHERE login = ?', $login);
     $err .= $DB->error;
     if ($err) {
         $err = parse_db_error($err);
     }
     return $ret;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:24,代码来源:employer.php

示例8: SetRefused

 /**
  * Установка статуса "Отказано" для автора данного предложения.
  *
  * @param integer $po_id     id предложения
  * @param integer $prj_id    id проекта
  * @param integer $user_id   id пользователя
  * @param integer $po_reason причина отказа (0 - некорректен, 1 - не подходят работы, 2 - не подходит цена, 3 - другая причина)
  * @param boolean $selected  отказано (true) / не отказано (false)
  *
  * @return string сообщение об ошибке
  */
 public function SetRefused($po_id, $prj_id, $user_id, $po_reason = 0, $refused = true)
 {
     global $DB;
     $po_id = intval($po_id);
     $prj_id = intval($prj_id);
     $user_id = intval($user_id);
     $po_reason = intval($po_reason);
     $sql = "UPDATE projects_offers SET refused='" . ($refused ? 't' : 'f') . "', refuse_reason=?i WHERE id=?i AND project_id=?i AND user_id=?i RETURNING user_id";
     $frl_id = $DB->val($sql, $po_reason, $po_id, $prj_id, $user_id);
     $error = parse_db_error($DB->error);
     $mem = new memBuff();
     $mem->delete('prjEventsCnt' . $frl_id);
     $mem->delete('prjEventsCntWst' . $frl_id);
     return $error;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:26,代码来源:projects_offers.php

示例9: InitFromSQL

 /**
  * Инициализировать переменные класса данными из таблицы с помощью произвольного запроса.
  *
  * @param string $where строка после WHERE
  *
  * @return string сообщение об ошибке
  */
 public function InitFromSQL($where_prms, $any_base = true)
 {
     global $DB;
     $fields = array();
     $current = get_class($this);
     $class_vars = get_class_vars(get_class($this));
     $inner_counters = 'LEFT JOIN users_counters uc ON uc.user_id = uid';
     foreach ($class_vars as $name => $value) {
         if ($name == 'rating') {
             $fields[] = "rating_get({$current}.rating, {$current}.is_pro, {$current}.is_verify, {$current}.is_profi) as rating";
             continue;
         }
         if ($name != 'passwd') {
             $fields[] = $current . '.' . $name;
         }
     }
     $fld = implode(', ', $fields);
     $where = array_shift($where_prms);
     $sql = "SELECT {$fld}, uc.ops_frl_null as ops_null, uc.ops_frl_plus as ops_plus, uc.ops_frl_minus as ops_minus\n                FROM {$current} {$inner_counters} WHERE {$where}";
     array_unshift($where_prms, $sql);
     $result = call_user_func_array(array($DB, 'row'), $where_prms);
     if ($DB->error) {
         $error = parse_db_error($DB->error);
     } else {
         if ($result) {
             foreach ($result as $name => $value) {
                 $this->{$name} = $value;
             }
         }
     }
     return $error;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:39,代码来源:users.php

示例10: GetThread

 /**
  * Инициализирует дерево сообщений в данной теме
  *
  * @param integer $thread_id		идентификатор темы
  * @param string $error				сообщение об ошибке
  * @param integer $mod				имеет ли текущий юзер права на просмотр данного раздела [1 - да, 0 - нет]
  * @param integer $fid				UID текущего юзера
  * @return array					[название раздела блогов, идентификатор раздела, идентификатор "базы"]
  */
 function GetThread($thread_id, &$error, $mod = 1, $fid = 0)
 {
     global $DB;
     $sql = "SELECT id_gr, base, is_private::int, close_comments::int, fav_cnt FROM blogs_themes WHERE thread_id='{$thread_id}'\n                UNION ALL\n                SELECT id_gr, base, null::int as is_private, null::int as close_comments, null as fav_cnt FROM blogs_themes_old WHERE thread_id='{$thread_id}'";
     $res = $DB->row($sql);
     if (!$res) {
         $error = "Группа не найдена или недоступна.";
         return 0;
     }
     $error = $DB->error;
     if ($fid) {
         $r = $DB->row("SELECT last_view, status FROM blogs_themes_watch WHERE user_id = ? AND theme_id = ?", $fid, $thread_id);
         if ($r['last_view']) {
             $new = $DB->parse(", (? < post_time) AS new, ?i AS read_comments", $r['last_view'], (int) $r['status']);
         }
     }
     $this->id_gr = $res['id_gr'];
     $this->base = $res['base'];
     $this->is_private = $res['is_private'];
     $this->close_comments = $res['close_comments'];
     $this->fav_cnt = $res['fav_cnt'];
     $name = $this->GetGroupName($this->id_gr, $this->base, $mod);
     if (!$name) {
         $error = "Группа не найдена или недоступна.";
         return 0;
     }
     $sql = "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tblogs_msgs.id, deleted_reason, fromuser_id, reply_to, post_time, msgtext, yt_link, blogs_msgs.title, modified, modified_id, deluser_id, deleted,\n\t\t\t\t\t\tusers.uname, users.usurname, users.login, users.photo, users.is_pro_test, users.role, users.is_chuck, users.is_team,\n\t\t\t\t\t\tusers.warn, users.is_banned, users.ban_where, users.is_pro as payed, users.is_pro_test as payed_test, users.reg_date, freelancer.spec, -- p.name as prof_name,\n\t\t\t\t\t\tadmins.uname AS modername, admins.usurname AS modersurname, admins.login AS moderlogin,\n\t\t\t\t\t\tblogs_poll.question as poll_question, blogs_poll.closed as poll_closed, blogs_poll.multiple as poll_multiple, sbr_meta.completed_cnt, moderator_status {$new}\n\t\t\t\t\tFROM blogs_msgs\n\t\t\t\t\tINNER JOIN users ON fromuser_id=users.uid\n\t\t\t\t\tLEFT JOIN freelancer ON fromuser_id=freelancer.uid\n\t\t\t\t\tLEFT JOIN users AS admins ON moderator_status = admins.uid\n                    LEFT JOIN sbr_meta ON sbr_meta.user_id=fromuser_id\n\t\t\t\t\t-- LEFT JOIN professions p ON p.id = freelancer.spec_orig\n\t\t\t\t\tLEFT JOIN blogs_poll ON blogs_poll.thread_id = blogs_msgs.thread_id\n\t\t\t\t\t{$join}\n\t\t\t\t\tWHERE blogs_msgs.thread_id= ?i ORDER BY reply_to, post_time\n\t\t\t\t";
     $this->thread = $DB->rows($sql, $thread_id);
     $error .= $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $this->msg_num = count($this->thread);
         if ($this->msg_num > 0) {
             // аттач файлов
             $this->AddAttach($this->thread);
             // заблокирован ли топик
             if ($fid && $fid == $_SESSION['uid']) {
                 $role = $_SESSION['role'];
             } else {
                 if ($fid) {
                     $users = new users();
                     $role = $users->GetField($fid, $error, 'role');
                 } else {
                     $role = 0;
                 }
             }
             $is_moder = hasPermissions('blogs');
             if ($is_moder) {
                 $row = $DB->row("SELECT blogs_blocked.admin, blogs_blocked.reason, blogs_blocked.blocked_time, users.login as admin_login, users.uname as admin_name, users.usurname as admin_uname FROM blogs_blocked JOIN users ON blogs_blocked.admin = users.uid WHERE thread_id = ?i", $thread_id);
             } else {
                 $row = $DB->row("SELECT admin, reason, blocked_time FROM blogs_blocked WHERE thread_id = ?i", $thread_id);
             }
             if ($row) {
                 $this->is_blocked = 1;
                 $this->thread[$this->msg_num - 1] = array_merge($this->thread[$this->msg_num - 1], $row);
             } else {
                 $this->is_blocked = 0;
             }
             if ($this->thread[$this->msg_num - 1]['poll_question']) {
                 $r = $DB->rows("SELECT * FROM blogs_poll_answers WHERE thread_id = '{$thread_id}' ORDER BY id", $thread_id);
                 $this->thread[$this->msg_num - 1]['poll'] = $r;
             }
             // читаем тред
             $this->SetVars($this->msg_num - 1);
             if ($mod) {
                 require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
                 $user = new users();
                 $user->GetUser($this->login);
                 if ($user->is_banned && $user->ban_where <= 1) {
                     $error = "Тред не найден или недоступен.";
                     return 0;
                 }
             }
             // доступ
             if ($this->is_blocked && !($fid && $fid == $this->fromuser_id || $is_moder)) {
                 $error = "Тред заблокирован администрацией";
                 return 0;
             }
         }
     }
     return array($name, $this->id_gr, $this->base);
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:92,代码来源:blogs.php

示例11: GetMsgComInfo

 /**
  * Получает комментрий к отзыву по его id
  *
  * @param integer $id              id комментария
  *
  * @return mixed                   массив с данными комментария или текст ошибки в случае неуспеха
  */
 function GetMsgComInfo($msg_id)
 {
     global $DB;
     $sql = "SELECT id, user_id, comment, opinion_id FROM opinion_comments WHERE id = ?";
     $res = $DB->query($sql, $msg_id);
     $error = pg_errormessage();
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $ret = pg_fetch_assoc($res);
     }
     return $ret;
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:20,代码来源:opinions.php

示例12: GetThreads

 /**
  * Выборка тем сообщений
  *
  * @param integer $item_id  ИД треда
  * @param string  $error    Возвращает сообщения об ошибке
  */
 function GetThreads($item_id, &$error)
 {
     global $DB;
     $curname = get_class($this);
     $sql = "SELECT id, blg.from_id, parent_id, created_time, msgtext,\n                    modified_id, deleted_id,\n                    modified_time,\n                    u.uname, u.usurname, u.is_banned, u.login, u.photo, u.is_pro, u.is_pro_test, u.role,\n                    mod.uname as mod_name, mod.usurname as mod_usurname, mod.login as mod_login, mod.role as mod_role,\n                    youtube_link\n                FROM articles_comments as blg\n                INNER JOIN users as u ON u.uid=blg.from_id\n                LEFT JOIN users as mod ON mod.uid=blg.modified_id\n                WHERE blg.article_id=?i\n                ORDER BY created_time";
     $this->thread = $DB->rows($sql, $item_id);
     $error .= $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     } else {
         $this->msg_num = count($this->thread);
         if ($this->msg_num > 0) {
             $this->SetVars(0);
         }
     }
     //return array($name, $id_gr, 99);
 }
开发者ID:Nikitian,项目名称:fl-ru-damp,代码行数:23,代码来源:articles_comments.php

示例13: addAnswerManager

 /**
  * Добавление ответа менеджера, по заявке.
  *
  * @param string $msg    Сообщение
  * @param int    $id     ИД заявки
  * @param int    $status Статус (принять(1)/отказать(0))
  *
  * @return bool
  */
 public function addAnswerManager($msg, $id, $status = 1)
 {
     global $DB;
     $type = $status == 1 ? 'msg_green' : 'msg_red';
     $DB->update('my_manager', array($type => $msg, 'status' => $status), 'id = ?i', $id);
     $error = $DB->error;
     $sql = 'SELECT uid FROM my_manager as m WHERE m.id = ?i LIMIT 1 OFFSET 0';
     $uid = $DB->val($sql, $id);
     if ($DB->error) {
         $error = parse_db_error($DB->error);
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
     $smail = new smail();
     $smail->sendManagerAnswer($uid, $msg);
     return true;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:25,代码来源:manager.php

示例14: GetField

 /**
  * Берем определенной поле из портфолио по его ИД.
  *
  * @param integer $id         ИД портфолио
  * @param string  $fieldname  Имя поля
  *
  * @return string Значение поля
  */
 public function GetField($id, $fieldname)
 {
     global $DB;
     $sql = "SELECT {$fieldname} FROM portfolio WHERE (id= ?i )";
     $ret = $DB->val($sql, $id);
     $error = $DB->error;
     if ($error) {
         $error = parse_db_error($error);
     }
     return $ret;
 }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:19,代码来源:portfolio.php


注:本文中的parse_db_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。