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


PHP Db::fetch_assoc方法代码示例

本文整理汇总了PHP中Db::fetch_assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::fetch_assoc方法的具体用法?PHP Db::fetch_assoc怎么用?PHP Db::fetch_assoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Db的用法示例。


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

示例1: pagination

 function pagination($messageParPage, $sscategorie, $search, $searchColumn)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $pagination_array = array();
     if (!empty($search)) {
         $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . CATEGORIE_NOM . " WHERE sscat_radio = '" . $sscategorie . "' AND ";
         for ($i = 0; $i < sizeof($searchColumn); $i++) {
             if ($i != 0 && $i != sizeof($searchColumn)) {
                 $sqlQuery .= "OR ";
             }
             $sqlQuery .= $searchColumn[$i] . " like '%" . Db::escape($search) . "%' ";
         }
     } else {
         $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . CATEGORIE_NOM . " WHERE sscat_radio = '" . $sscategorie . "'";
     }
     $getTotal = Db::query($sqlQuery);
     $donnees_total = Db::fetch_assoc($getTotal);
     $pagination_array[0] = $donnees_total['total'];
     $pagination_array[1] = ceil($pagination_array[0] / $messageParPage);
     if (isset($_POST['page'])) {
         $pagination_array[2] = intval($_POST['page']);
         if ($pagination_array[2] > $pagination_array[1] && $pagination_array[1] > 0) {
             $pagination_array[2] = $pagination_array[1];
         }
     } else {
         $pagination_array[2] = 1;
     }
     $pagination_array[3] = ($pagination_array[2] - 1) * $messageParPage;
     return $pagination_array;
 }
开发者ID:WebPassions,项目名称:2014,代码行数:35,代码来源:utils.class.php

示例2: pagination

 function pagination($messageParPage, $table, $sscategorie)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $sscategorie = Utils::anti_injection($sscategorie);
     $pagination_array = array();
     $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . $table . " WHERE sscat_radio=" . $sscategorie;
     $getTotal = Db::query($sqlQuery);
     $donnees_total = Db::fetch_assoc($getTotal);
     $pagination_array[0] = $donnees_total['total'];
     $pagination_array[1] = ceil($pagination_array[0] / $messageParPage);
     if (isset($_GET['page'])) {
         $pagination_array[2] = intval($_GET['page']);
         if ($pagination_array[2] > $pagination_array[1] && $pagination_array[1] > 0) {
             $pagination_array[2] = $pagination_array[1];
         }
     } else {
         $pagination_array[2] = 1;
     }
     $pagination_array[3] = ($pagination_array[2] - 1) * $messageParPage;
     return $pagination_array;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:26,代码来源:utils.class.php

示例3: login

 function login()
 {
     $retour = false;
     $login = Db::escape($_POST['login']);
     $getAuth = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . Db::escape(md5($_POST['mdp'])) . "'");
     if (Db::num_rows($getAuth) > 0) {
         $_SESSION['key'] = true;
         // Mise en session de la connexion
         $entry = Db::fetch_assoc($getAuth);
         $retour = true;
     } else {
         $getLogin = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'");
         if (Db::num_rows($getLogin) > 0) {
             $this->login = $login;
             $getPwd = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . Db::escape(md5($_POST['mdp'])) . "'");
             if (Db::num_rows($getPwd) <= 0) {
                 $this->errors = "pwd";
             }
         } else {
             $this->errors = "login";
         }
         $retour = false;
     }
     return $retour;
 }
开发者ID:WebPassions,项目名称:2015,代码行数:25,代码来源:auth.class.php

示例4: pagination2

 function pagination2($messageParPage, $table, $id)
 {
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Premiere entree
     */
     $id = Utils::anti_injection($id);
     $pagination_array = array();
     $sqlQuery = "SELECT COUNT(*) AS total FROM " . TABLE_PREFIX . $table . " where titre_txt_fr like '%" . $id . "%' or description_txtbox_fr like '%" . $id . "%'";
     $getTotal = Db::query($sqlQuery);
     $donnees_total = Db::fetch_assoc($getTotal);
     $pagination_array[0] = $donnees_total['total'];
     $pagination_array[1] = ceil($pagination_array[0] / $messageParPage);
     if (isset($_GET['page'])) {
         $pagination_array[2] = intval($_GET['page']);
         if ($pagination_array[2] > $pagination_array[1] && $pagination_array[1] > 0) {
             $pagination_array[2] = $pagination_array[1];
         }
     } else {
         $pagination_array[2] = 1;
     }
     $pagination_array[3] = ($pagination_array[2] - 1) * $messageParPage;
     return $pagination_array;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:26,代码来源:utils.class.php

示例5: login

 function login()
 {
     $retour = false;
     $this->login = Db::escape($_POST[LOGIN]);
     $_SESSION['user'] = $this->login;
     $mdp = Db::escape($_POST['mdp']);
     $getAuth = Query::connexion($this->login, $mdp);
     if (Db::num_rows($getAuth) > 0) {
         $entry = Db::fetch_assoc($getAuth);
         // Mise en session de la connexion et des accès
         $_SESSION['key'] = true;
         $_SESSION[LOGIN] = $this->login;
         foreach ($entry as $column => $value) {
             if ($column == ACCESS) {
                 $_SESSION[ACCESS] = $value;
             }
         }
         // Sauve la transaction pour l'historique
         Db::add_transaction_execute(LOGIN, "4294967290", $_SESSION[LOGIN]);
         $retour = true;
     } else {
         $getLogin = Query::connexionLogin($this->login);
         if (Db::num_rows($getLogin) > 0) {
             $this->errors = "pwd";
         } else {
             $this->errors = LOGIN;
         }
         $retour = false;
     }
     return $retour;
 }
开发者ID:WebPassions,项目名称:2015,代码行数:31,代码来源:helperAuth.class.php

示例6: getFeeds

 /**
  * Find feeds from db
  *
  * @return array feeds
  */
 protected function getFeeds()
 {
     $feeds = array();
     $result = $this->dbh->query("SELECT id, title\n                FROM ttrss_feeds\n                WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY order_id, title");
     while ($line = $this->dbh->fetch_assoc($result)) {
         $feeds[] = (object) $line;
     }
     return $feeds;
 }
开发者ID:k2s,项目名称:af_refspoof,代码行数:14,代码来源:init.php

示例7: sendNewsletter

 function sendNewsletter($titre, $contenu, $view)
 {
     $passage_ligne = "\r\n";
     //=====Déclaration des messages au format HTML
     $patterns = array();
     $replacements = array();
     $patterns[0] = '/<h1/';
     $replacements[0] = '<h1 style="width:770px;line-height:25px;font-size:18px;padding-left:5px;background-color:#f49f25;"';
     $string = preg_replace($patterns, $replacements, stripslashes($contenu));
     $string = str_replace('../albums', 'http://www.pcf-cdh.be/albums', $string);
     $string = str_replace("<a href=", "<a style=\"color:#f49f25;\" href=", $string);
     $message_html = "\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:11px;font-family:Verdana;\">\n\t\t\t\t<div>\n\t\t\t\t\t<img src=\"http://www.pcf-cdh.be/images/header.jpg\" height=\"175px;\" />\n\t\t\t\t</div>\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\n\t\t\t\t" . $string . "\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\t<a style=\"text-decoration:none;\" href=\"http://www.pcf-cdh.be/deputy.php\"><img src=\"http://www.pcf-cdh.be/images/footer.jpg\" style=\"height:66px;border:none;\" /></a>\n\t\t\t\t\t<a style=\"text-decoration:none;\" href=\"http://www.pcf-cdh.be\"><img src=\"http://www.pcf-cdh.be/images/footer2.jpg\" style=\"height:50px;border:none;\" /></a>\n\t\t\t\t</div>\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.pcf-cdh.be/desincription.php\">Se désabonner de la newsletters</a>\n\t\t\t\t</div>\n\t\t\t</div>";
     //=====Création de la boundary
     $boundary = "-----=" . md5(rand());
     $boundary_alt = "-----=" . md5(rand());
     //=====Définition du sujet
     $sujet = "Newsletter du groupe cdH : " . $titre;
     //=========
     //=====Création du header de l'e-mail
     $header = "From: " . MAIL . "" . $passage_ligne;
     $header .= "Reply-to: " . MAIL . "" . $passage_ligne;
     $header .= "MIME-Version: 1.0" . $passage_ligne;
     $header .= "Content-Type: multipart/mixed;" . $passage_ligne . " boundary=\"{$boundary}\"" . $passage_ligne;
     //==========
     //=====Création du message
     $message = $passage_ligne . "--" . $boundary . $passage_ligne;
     $message .= "Content-Type: multipart/alternative;" . $passage_ligne . " boundary=\"{$boundary_alt}\"" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne;
     //=====Ajout du message au format HTML
     $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $passage_ligne;
     $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne;
     $message .= $passage_ligne . $message_html . $passage_ligne;
     //=====On ferme la boundary alternative
     $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary . $passage_ligne;
     //=====Envoi de l'e-mail
     if ($view == true) {
         $sqlQuery = "SELECT email_txt FROM cdh_newsletter";
         $getEntries = Db::query($sqlQuery);
         if (Db::num_rows($getEntries) > 0) {
             $entry = Db::fetch_assoc($getEntries);
             while ($entry) {
                 foreach ($entry as $column => $value) {
                     $value = stripslashes(htmlentities($value, ENT_QUOTES, "iso-8859-1"));
                     mail($value, $sujet, $message, $header);
                 }
                 $entry = Db::fetch_assoc($getEntries);
             }
         }
         header("Location: http://www.pcf-cdh.be/admin/index.php?module=newsletter&categorie=5&sscategorie=14&send=true");
     } else {
         mail('', $sujet, $message, $header);
         mail('', $sujet, $message, $header);
         mail('', $sujet, $message, $header);
         header("Location: http://www.pcf-cdh.be/admin/index.php?module=newsletter&categorie=5&sscategorie=14&send=true");
     }
 }
开发者ID:WebPassions,项目名称:2014,代码行数:57,代码来源:mail.class.php

示例8: sendNewsletter

 function sendNewsletter($titre, $contenu, $view)
 {
     $passage_ligne = "\r\n";
     //=====Declaration des messages au format HTML
     $patterns = array();
     $patterns[0] = '/<img src="../albums/';
     $replacements = array();
     $replacements[0] = '<img src="http://www.microniser.com/albums/';
     $string = preg_replace($patterns, $replacements, stripslashes($contenu));
     $string = str_replace("<a href=", "<a style=\"color:#f49f25;\" href=", $string);
     $message_html = "\r\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:10px;font-family:Verdana;\">\r\n\t\t\t\t<div>\r\n\t\t\t\t\tIMAGE ENTETE\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\r\n\t\t\t\t" . $string . "\r\n\t\t\t\t</div>\r\n\t\t\t\t<div>\r\n\t\t\t\t\tIMAGE PIED DE PAGE\r\n\t\t\t\t</div>\r\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\r\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.microniser.com/desincription.php\">Se d&eacute;sabonner de la newsletters</a>\r\n\t\t\t\t</div>\r\n\t\t\t</div>";
     //=====Creation de la boundary
     $boundary = "-----=" . md5(rand());
     $boundary_alt = "-----=" . md5(rand());
     //=====Definition du sujet
     $sujet = "Newsletter Microniser : " . $titre;
     //=========
     //=====Creation du header de l'e-mail
     $header = "From: " . MAIL . "" . $passage_ligne;
     $header .= "Reply-to: " . MAIL . "" . $passage_ligne;
     $header .= "MIME-Version: 1.0" . $passage_ligne;
     $header .= "Content-Type: multipart/mixed;" . $passage_ligne . " boundary=\"{$boundary}\"" . $passage_ligne;
     //==========
     //=====Creation du message
     $message = $passage_ligne . "--" . $boundary . $passage_ligne;
     $message .= "Content-Type: multipart/alternative;" . $passage_ligne . " boundary=\"{$boundary_alt}\"" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary_alt . $passage_ligne;
     //=====Ajout du message au format HTML
     $message .= "Content-Type: text/html; charset=\"ISO-8859-1\"" . $passage_ligne;
     $message .= "Content-Transfer-Encoding: 8bit" . $passage_ligne;
     $message .= $passage_ligne . $message_html . $passage_ligne;
     //=====On ferme la boundary alternative
     $message .= $passage_ligne . "--" . $boundary_alt . "--" . $passage_ligne;
     $message .= $passage_ligne . "--" . $boundary . $passage_ligne;
     //=====Envoi de l'e-mail
     if ($view == true) {
         $sqlQuery = "SELECT email_txt FROM micro_newsletters";
         $getEntries = Db::query($sqlQuery);
         if (Db::num_rows($getEntries) > 0) {
             $entry = Db::fetch_assoc($getEntries);
             while ($entry) {
                 foreach ($entry as $column => $value) {
                     $value = stripslashes(htmlentities($value, ENT_QUOTES, "iso-8859-1"));
                     //mail($value, $sujet, $message, $header);
                 }
                 $entry = Db::fetch_assoc($getEntries);
             }
         }
         header("Location: http://www.microniser.com/admin/index.php?module=newsletters&categorie=7&sscategorie=41&send=true");
     } else {
         mail('', $sujet, $message, $header);
         header("Location: http://www.microniser.com/admin/index.php?module=newsletters&categorie=7&sscategorie=41");
     }
 }
开发者ID:WebPassions,项目名称:2015,代码行数:54,代码来源:mail.class.php

示例9: sendNewsletter

 function sendNewsletter($groupe, $sujet, $contenu)
 {
     //=====Declaration des messages au format HTML
     $message_html = "\n\t\t\t<div style=\"width:800px;min-height:600px;font-size:10px;font-family:Verdana;\">\n\t\t\t\t<div>\n\t\t\t\t\tIMAGE ENTETE\n\t\t\t\t</div>\n\t\t\t\t<div style=\"margin-left:14px;width:770px;min-height:300px;\">\n\t\t\t\t" . $contenu . "\n\t\t\t\t</div>\n\t\t\t\t<div>\n\t\t\t\t\tIMAGE PIED DE PAGE\n\t\t\t\t</div>\n\t\t\t\t<div style=\"width:800px;text-align:center;\">\n\t\t\t\t\t<a style=\"text-decoration:none;font-size:8px;\" href=\"http://www.microniser.com/desincription.php\">Se d&eacute;sabonner de la newsletters</a>\n\t\t\t\t</div>\n\t\t\t</div>";
     //=====Envoi de l'e-mail
     $getEntries = Query::selectEmailNewslettersWithGroup($groupe);
     if (Db::num_rows($getEntries) > 0) {
         $entry = Db::fetch_assoc($getEntries);
         while ($entry) {
             foreach ($entry as $column => $email) {
                 //Mail::ConstructBoundary($email, $sujet, $message_html)
                 echo $email;
             }
             $entry = Db::fetch_assoc($getEntries);
         }
     }
     header("Location: " . SITE_URL . "/admin/webpassions.php?module=historiquenewsletters&categorie=130&sscategorie=130&send=send" . $groupe);
 }
开发者ID:WebPassions,项目名称:2015,代码行数:18,代码来源:helperMail.class.php

示例10: getEnumValue

 function getEnumValue($column, $val)
 {
     $sqlQuery = "SELECT " . $column . " FROM " . TABLE_PREFIX . CATEGORIE_NOM . "_" . $column;
     $getEntries = Db::query($sqlQuery);
     $tmp = '<select name="' . $column . '" class="jNiceSelectWrapper"><option></option>';
     if (Db::num_rows($getEntries) > 0) {
         $entry = Db::fetch_assoc($getEntries);
         while ($entry) {
             foreach ($entry as $column => $option) {
                 $selected = $val == $option ? 'selected="selected"' : '';
                 // are we selected?
                 $tmp .= '<option value="' . $option . '" ' . $selected . '>' . $option . '</option>';
             }
             $entry = Db::fetch_assoc($getEntries);
         }
     }
     $tmp .= '</select>';
     return $tmp;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:19,代码来源:select.field.php

示例11: login

 function login()
 {
     $retour = false;
     $login = Db::escape($_POST['login']);
     $mdp = Db::escape($_POST['mdp']);
     $getAuth = Query::connexion($login, $mdp);
     if (Db::num_rows($getAuth) > 0) {
         // Mise en session de la connexion
         $_SESSION['key'] = true;
         $entry = Db::fetch_assoc($getAuth);
         $retour = true;
     } else {
         $getLogin = Query::connexionLogin($login);
         if (Db::num_rows($getLogin) > 0) {
             $this->login = $login;
             $this->errors = "pwd";
         } else {
             $this->errors = "login";
         }
         $retour = false;
     }
     return $retour;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:23,代码来源:auth.class.php

示例12: pagination

 function pagination($messageParPage, $sscategorie, $search, $searchColumn)
 {
     $pagination_array = array();
     /*
     paginatio_array 0->Nbre d'enregistrements
     paginatio_array 1->Nbre de pages
     paginatio_array 2->Pages actuelle
     paginatio_array 3->Première entrée
     */
     $getTotal = Query::pagination($sscategorie, $search, $searchColumn);
     $donnees_total = Db::fetch_assoc($getTotal);
     $pagination_array[0] = $donnees_total['total'];
     $pagination_array[1] = ceil($pagination_array[0] / $messageParPage);
     if (isset($_POST['page'])) {
         $pagination_array[2] = intval($_POST['page']);
         if ($pagination_array[2] > $pagination_array[1] && $pagination_array[1] > 0) {
             $pagination_array[2] = $pagination_array[1];
         }
     } else {
         $pagination_array[2] = 1;
     }
     $pagination_array[3] = ($pagination_array[2] - 1) * $messageParPage;
     return $pagination_array;
 }
开发者ID:WebPassions,项目名称:2015,代码行数:24,代码来源:utils.class.php

示例13: login

 function login()
 {
     $retour = false;
     $login = Utils::anti_injection($_POST['login']);
     $getAuth = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'");
     if (Db::num_rows($getAuth) > 0) {
         $mdp = Utils::anti_injection($_POST['mdp']);
         $getMdp = Db::query("SELECT * FROM `" . TABLE_PREFIX . "admin` WHERE `login_txt` = '" . $login . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `mdp_txt` = '" . md5($mdp) . "'");
         if (Db::num_rows($getMdp) > 0) {
             $_SESSION['key'] = true;
             // Mise en session de la connexion
             $retour = true;
         } else {
             $this->login = $login;
             $this->errors = "pwd";
             $retour = false;
         }
         $entry = Db::fetch_assoc($getMdp);
     } else {
         $this->errors = "login";
         $retour = false;
     }
     return $retour;
 }
开发者ID:WebPassions,项目名称:2012-11-10,代码行数:24,代码来源:auth.class.php

示例14: displaySSMenu

 function displaySSMenu($lang)
 {
     $layout = "";
     $getssCategories = Query::sousCategories();
     $ssCategorie = Db::fetch_assoc($getssCategories);
     while ($ssCategorie) {
         $url = 'module=' . CATEGORIE_NOM . '&categorie=' . CATEGORIE_ID . '&sscategorie=' . $ssCategorie['id'];
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'' . $url . '\');return false;">' . $lang[WRAPPER][$ssCategorie['sscategorie']] . '</a>';
         $layout .= '</li>';
         $ssCategorie = Db::fetch_assoc($getssCategories);
     }
     if (empty($layout)) {
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=dashboard\');return false;">' . $lang[WRAPPER]['tableau'] . '</a>';
         $layout .= '</li>';
         if ($_SESSION[ACCESS] == FULL) {
             $layout .= '<li>';
             $layout .= '<a href="webpassions.php" onclick="formURL(\'module=statistique&categorie=110\');return false;">' . $lang[WRAPPER]['statistique'] . '</a>';
             $layout .= '</li>';
         }
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=document&categorie=100&folder=123456789cms\');return false;">' . $lang[WRAPPER]['help'] . '</a>';
         $layout .= '</li>';
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'module=contact\');return false;">' . $lang[WRAPPER]['contact'] . '</a>';
         $layout .= '</li>';
         $layout .= '<li>';
         $layout .= '<a href="webpassions.php" onclick="formURL(\'authenticate=out\');return false;">' . $lang[WRAPPER][LOGOUT] . '</a>';
         $layout .= '</li>';
     }
     return $layout;
 }
开发者ID:WebPassions,项目名称:2015,代码行数:33,代码来源:HelperMenu.class.php

示例15: table_list_grid

 public static function table_list_grid($request, $table, $field, $condition, $order = '', $bilrow = 10, $dbg = 'N')
 {
     $error = '';
     $x = 0;
     $cari = chk($request['cari']);
     $all = chk($request['fw_all']);
     $sql = "SELECT {$field} FROM {$table} WHERE {$condition}";
     list($data, $sts) = Db::query($sql);
     if ($sts != '1') {
         echo $sts;
     } else {
         if ($order == '') {
             $order = Db::field_name($data, 0);
         }
         if ($cari != '') {
             $cari = str_replace("'", "''", $cari);
             $bil_field = Db::num_fields($data);
             $carian = '';
             $array_field = explode(",", $field);
             //echo '<pre>'; print_r($array_field); echo '</pre>';
             $bil_field = count($array_field);
             for ($a = 0; $a < $bil_field; $a++) {
                 $nama_field = Db::field_name($data, $a);
                 //                            $nama_field_all = $array_field[$a];
                 //
                 //                            $pos = strpos($nama_field_all, '*');
                 //
                 //                                if ($pos === false) {
                 //                                    $nama_field = $nama_field_all;
                 //                                    switch (Db::$db)
                 //                                    {
                 //                                        case 'Pg':
                 //                                            $carian = "$carian CAST($nama_field AS TEXT) ILIKE '%$cari%' OR";
                 //                                            break;
                 //                                        case 'Mysql':
                 //                                            $carian = "$carian $nama_field LIKE '%$cari%' OR";
                 //                                            break;
                 //                                        case 'Oci':
                 //                                            $carian = "$carian lower($nama_field) LIKE lower('%$cari%') OR";
                 //                                            break;
                 //                                    }
                 //                                }
                 $type_field = Db::field_type($data, $a);
                 $array_type = array("timestamp", "float8", "int4");
                 foreach ($array_field as $fieldselect) {
                     if (strpos($fieldselect, $nama_field) !== false) {
                         $nama_field = $fieldselect;
                     }
                     $position = strpos($nama_field, ' as ');
                     if ($position != '') {
                         $nama_field = substr($nama_field, '0', $position);
                     }
                     $position = strpos($nama_field, ' AS ');
                     if ($position != '') {
                         $nama_field = substr($nama_field, '0', $position);
                     }
                     $nama_field = str_replace('DISTINCT ', '', $nama_field);
                 }
                 if (!in_array($type_field, $array_type)) {
                     switch (Db::$db) {
                         case 'Pg':
                             $carian = "{$carian} CAST({$nama_field} AS TEXT) ILIKE '%{$cari}%' OR";
                             break;
                         case 'Mysql':
                             $carian = "{$carian} {$nama_field} LIKE '%{$cari}%' OR";
                             break;
                         case 'Oci':
                             $carian = "{$carian} lower({$nama_field}) LIKE lower('%{$cari}%') OR";
                             break;
                     }
                 }
             }
             $carian = "(" . substr($carian, 1, -3) . ")";
             $condition = "{$condition} AND {$carian}";
         }
         $totalreturned = Db::num_rows($table, $field, $condition);
         $request = datagrid($request, $totalreturned, $bilrow);
         $request['fw_all'] = $all;
         $page_end = $request['page_end'];
         $bilrow = $request['bilrow'];
         $limit = $request['limit'];
         if ($totalreturned == $page_end) {
             $page_end = $page_end - $bilrow;
         }
         if ($page_end < '0') {
             $page_end = '0';
         }
         if (Db::$db == 'Oci') {
             $maxrow = $page_end + $bilrow;
             $sql = "SELECT * FROM (\n                                SELECT a.*, ROWNUM fw_bil FROM (\n                                  SELECT {$field}\n                                    FROM {$table}\n                                       WHERE {$condition}\n                                           ORDER BY {$order}\n                                ) a WHERE rownum <= {$maxrow}\n                              ) where fw_bil > {$page_end}";
             //  ORDER BY $order";
         } else {
             $condition = "{$condition} ORDER BY {$order} LIMIT {$bilrow} OFFSET {$page_end} ";
             $sql = "SELECT {$field} FROM {$table} WHERE {$condition}";
         }
         list($data, $sts) = Db::query($sql);
         if ($sts != '1') {
             echo $sts;
         } else {
             $datarow = Db::fetch_assoc($data);
//.........这里部分代码省略.........
开发者ID:hezrul,项目名称:seashell,代码行数:101,代码来源:class.db.php


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