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


PHP Items::find_by_sql方法代碼示例

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


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

示例1: getList

 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM items");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Items::find_by_sql("SELECT * FROM items " . $pagin->pgLimit($pn));
     $index_array = array("items" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
開發者ID:runningjack,項目名稱:RobertJohnson,代碼行數:30,代碼來源:stockitems_model.php

示例2: getList

 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     $itemnamefield = "";
     $descfield = "";
     $condifield = "";
     print_r($_POST['condi']);
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_POST['itemname']) && !empty($_POST['itemname'])) {
         $itemnamefield .= " AND item_name = '" . $_POST['itemname'] . "' ";
     }
     if (isset($_POST['descript']) && !empty($_POST['descript'])) {
         $descfield .= " AND item_description LIKE '%" . $_POST['descript'] . "%' ";
     }
     if (!empty($_POST['price']) && !empty($_POST['condi'])) {
         $condifield .= " AND item_cost " . $_POST['condi'] . " " . $_POST["price"];
     }
     if (!empty($_POST['fdate']) && !empty($_POST['tdate'])) {
         $datefield .= " AND datecreated BETWEEN  '" . $_POST['fdate'] . "' AND '" . $_POST['tdate'] . "' ";
     }
     if (empty($_POST['fdate']) && !empty($_POST['tdate'])) {
         $datefield .= " AND datecreated < '" . $_POST['tdate'] . "' ";
     }
     if (!empty($_POST['fdate']) && empty($_POST['tdate'])) {
         $datefield .= " AND datecreated >  '" . $_POST['fdate'] . "'  ";
     }
     $filterResult .= " WHERE id !='' " . $itemnamefield . $descfield . $condifield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM items " . $filterResult);
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Items::find_by_sql("SELECT * FROM items " . $filterResult . " " . $pagin->pgLimit($pn));
     $index_array = array("items" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
 }
開發者ID:runningjack,項目名稱:RobertJohnson,代碼行數:56,代碼來源:stockitems_model.php

示例3: itemID_AutoComplete

 /**
  * this section is used to get auto complete
  * feature for the item 
  * textbox
  */
 public function itemID_AutoComplete($id = "")
 {
     return Items::find_by_sql("SELECT * FROM items WHERE item_name LIKE '%" . $_POST['input'] . "%'");
 }
開發者ID:runningjack,項目名稱:RobertJohnson,代碼行數:9,代碼來源:stockin_model.php


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