當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TPage::getByID方法代碼示例

本文整理匯總了PHP中TPage::getByID方法的典型用法代碼示例。如果您正苦於以下問題:PHP TPage::getByID方法的具體用法?PHP TPage::getByID怎麽用?PHP TPage::getByID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TPage的用法示例。


在下文中一共展示了TPage::getByID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getByID

 /** Selects row from the table 'lang_pos' by ID.<br><br>
 * SELECT page_id,lang_id,pos_id,etymology_n,lemma FROM lang_pos WHERE id=8;
 * @return null if data is absent. */
 public static function getByID($lang_pos_id, $lang_all, $pos_all)
 {
     global $LINK_DB;
     $lang_pos = NULL;
     $query = "SELECT page_id,lang_id,pos_id,etymology_n,lemma FROM lang_pos WHERE id={$lang_pos_id}";
     $result = mysqli_query($LINK_DB, $query) or die("Query failed (line 31) in TLangPOS::getByID: " . mysqli_error() . ". Query: " . $query);
     while ($row = mysqli_fetch_array($result)) {
         $page_id = $row['page_id'];
         $lang_id = $row['lang_id'];
         $pos_id = $row['pos_id'];
         $etymology_n = $row['etymology_n'];
         $lemma = $row['lemma'];
         $lang_pos['page'] = TPage::getByID($page_id);
         //print "TLangPOS::getByID    lang_id = $lang_id<BR>";
         //print "TLangPOS::getByID    pos_id = $pos_id<BR>";
         $lang_pos['lang'] = TLang::getByID($lang_id, $lang_all);
         //print "TLangPOS::getByID    TLang lang = "; print_r ($lang_pos ['lang']); print "<BR>";
         $lang_pos['pos'] = TPOS::getByID($pos_id, $pos_all);
         //print "TLangPOS::getByID    TPOS  pos  = "; print_r($lang_pos ['pos']); print "<BR>";
         $lang_pos['etymology_n'] = $etymology_n;
         $lang_pos['lemma'] = $lemma;
         $lang = $lang_pos['lang'];
         $pos = $lang_pos['pos'];
         if (null == $lang || null == $pos) {
             $lang_pos = NULL;
         }
     }
     return (object) $lang_pos;
 }
開發者ID:katerysh,項目名稱:wikokit,代碼行數:32,代碼來源:tlang_pos.php

示例2: getLangPOS

 /** Gets TLangPOS object by property $property_name with value $property_value.
  * @return TLangPOS or NULL in case of error
  */
 public static function getLangPOS($property_name, $property_value, $page_obj = NULL)
 {
     global $LINK_DB;
     $query = "SELECT * FROM lang_pos WHERE lang_id is not NULL and pos_id is not NULL and `{$property_name}`='{$property_value}' order by id";
     $result = $LINK_DB->query_e($query, "Query failed in " . __METHOD__ . " in file <b>" . __FILE__ . "</b>, string <b>" . __LINE__ . "</b>");
     if ($LINK_DB->query_count($result) == 0) {
         return NULL;
     }
     $lang_pos_arr = array();
     while ($row = $result->fetch_object()) {
         $lang = TLang::getByID($row->lang_id);
         $pos = TPOS::getByID($row->pos_id);
         if (NULL == $lang || NULL == $pos) {
             return NULL;
         }
         if ($page_obj == NULL) {
             $page_obj = TPage::getByID($row->page_id);
         }
         $lang_pos = new TLangPOS($row->id, $page_obj, $lang, $pos, $row->etymology_n, $row->lemma);
         $lang_pos->meaning = TMeaning::getByLangPOS($row->id, $lang_pos);
         $lang_pos_arr[] = $lang_pos;
     }
     return $lang_pos_arr;
 }
開發者ID:stasonmokoron,項目名稱:nerpa,代碼行數:27,代碼來源:TLangPOS.php


注:本文中的TPage::getByID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。