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


PHP mysql::select方法代码示例

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


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

示例1: getAccessories

 /**
  * Retourne une liste d'accessoires selon des paramètres donnés.
  *
  * @param array $params
  * @param boolean $count_only
  * @return object recordset/integer
  */
 public function getAccessories($params = array(), $count_only = false)
 {
     $reqPlus = '';
     if (!empty($params['id'])) {
         $reqPlus .= ' AND a.id=' . (int) $params['id'] . ' ';
     }
     if (!empty($params['product_id'])) {
         $reqPlus .= ' AND a.product_id=' . (int) $params['product_id'] . ' ';
     }
     if (isset($params['active'])) {
         if ($params['active'] == 0) {
             $reqPlus .= 'AND a.active=0 ';
         } elseif ($params['active'] == 1) {
             $reqPlus .= 'AND a.active=1 ';
         } elseif ($params['active'] == 2) {
             $reqPlus .= '';
         }
     } else {
         $reqPlus .= 'AND a.active=1 ';
     }
     if ($count_only) {
         $query = 'SELECT COUNT(a.id) AS num_accessories ' . 'FROM ' . $this->t_accessories . ' AS a ' . 'LEFT JOIN ' . $this->t_products . ' AS p ON p.id=a.product_id ' . 'WHERE 1 ' . $reqPlus;
     } else {
         $query = 'SELECT a.id, a.product_id, a.active, a.title, ' . 'p.title AS product_title ' . 'FROM ' . $this->t_accessories . ' AS a ' . 'LEFT JOIN ' . $this->t_products . ' AS p ON p.id=a.product_id ' . 'WHERE 1 ' . $reqPlus;
         if (!empty($params['order'])) {
             $query .= 'ORDER BY ' . $params['order'] . ' ';
         } else {
             $query .= 'ORDER BY p.title ASC, a.title ASC ';
         }
         if (!empty($params['limit'])) {
             $query .= 'LIMIT ' . $params['limit'] . ' ';
         }
     }
     if (($rs = $this->db->select($query)) === false) {
         if ($count_only) {
             return 0;
         } else {
             return new recordset(array());
         }
     }
     if ($count_only) {
         return (int) $rs->num_accessories;
     } else {
         return $rs;
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:53,代码来源:class.estimate.accessories.php

示例2: getProducts

 /**
  * Retourne une liste de produits selon des paramètres donnés.
  *
  * @param array $params
  * @param boolean $count_only
  * @return object recordset/integer
  */
 public function getProducts($params = array(), $count_only = false)
 {
     $reqPlus = '';
     if (!empty($params['id'])) {
         $reqPlus .= ' AND p.id=' . (int) $params['id'] . ' ';
     }
     if (isset($params['active'])) {
         if ($params['active'] == 0) {
             $reqPlus .= 'AND p.active=0 ';
         } elseif ($params['active'] == 1) {
             $reqPlus .= 'AND p.active=1 ';
         } elseif ($params['active'] == 2) {
             $reqPlus .= '';
         }
     } else {
         $reqPlus .= 'AND p.active=1 ';
     }
     if ($count_only) {
         $query = 'SELECT COUNT(p.id) AS num_products ' . 'FROM ' . $this->t_products . ' AS p ' . 'WHERE 1 ' . $reqPlus;
     } else {
         $query = 'SELECT p.id, p.active, p.title ' . 'FROM ' . $this->t_products . ' AS p ' . 'WHERE 1 ' . $reqPlus;
         if (!empty($params['order'])) {
             $query .= 'ORDER BY ' . $params['order'] . ' ';
         } else {
             $query .= 'ORDER BY p.title ASC ';
         }
         if (!empty($params['limit'])) {
             $query .= 'LIMIT ' . $params['limit'] . ' ';
         }
     }
     if (($rs = $this->db->select($query)) === false) {
         if ($count_only) {
             return 0;
         } else {
             return new recordset(array());
         }
     }
     if ($count_only) {
         return (int) $rs->num_products;
     } else {
         return $rs;
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:50,代码来源:class.estimate.products.php

示例3: mysql

<?php

// a_authordetails.php -- Admin view Author Details
include './functions.php';
require_once './config/auth.php';
require './config/config.php';
include "./classes/mysql.class.php";
$mysqldb = new mysql();
$mysqldb->connect();
$mysqldb->select();
$authorid = mifi($_REQUEST[aid]);
$mysqldb->query("SELECT CONCAT(FirstName, ' ', LastName) AS name, Approved, UserName, Email, DATE_FORMAT(RegistrationDate, '%M %d, %Y') AS dr, (SELECT count(*) from articles WHERE Approved = 'N' AND AuthorID='{$authorid}') AS PendingArticles, (SELECT count(*) from articles WHERE Approved = 'Y' AND AuthorID='{$authorid}') AS ApprovedArticles, (SELECT count(*) from articles WHERE Approved = 'S' AND AuthorID='{$authorid}') AS SavedArticles FROM authors WHERE AuthorID='{$authorid}'");
$row = $mysqldb->fetchObject();
$totalarticles = $row->ApprovedArticles + $row->PendingArticles + $row->SavedArticles;
if (isset($_REQUEST['newperms'])) {
    $title = 'Permissions Updated';
} else {
    $title = 'Author details for ' . $row->name . ' (' . $row->UserName . ')';
}
$approved = $row->Approved;
if ($approved != 'Y') {
    $approved = "<a href=\"aufe2a.php?aid={$authorid}\">{$row->Approved}</a>";
}
head_page($title);
menu_options($title, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($title);
echo <<<_AUTHORDETAILS
AuthorID : {$authorid}<br />
UserName : {$row->UserName}<br />
Full Name : {$row->name}<br />
Permissions : {$row->Approved}<br>
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:31,代码来源:a_authordetails.php

示例4: addtag

function addtag($id)
{
    if (!$id) {
        exit;
    }
    $mysqldb = new mysql();
    $mysqldb->connect();
    $mysqldb->select();
    $mysqldb->query("SELECT Keyw FROM articles WHERE FileID='{$id}'");
    $row = $mysqldb->fetchObject();
    $keystotags = $row->Keyw;
    // place keywords into tags table.
    $arrkeywords = explode(' ', $keystotags);
    foreach ($arrkeywords as $keyword) {
        if (strlen($keyword) > 4) {
            $mysqldb->query("INSERT INTO tags (fileid, tag) VALUES ('{$fileid}', '{$keyword}')");
        }
    }
}
开发者ID:rzs840707,项目名称:webapps_repository,代码行数:19,代码来源:functions.php

示例5: get

 public static function get($table, $idFields = null)
 {
     $select = self::$select;
     self::$select = '*';
     if ($idFields === null) {
         return self::query("SELECT {$select} FROM {$table}");
     } else {
         $idString = implode(' AND ', self::quoteArray($idFields, true));
         return self::query("SELECT {$select} FROM {$table} WHERE {$idString}");
     }
 }
开发者ID:42Khane,项目名称:PHP-Framework,代码行数:11,代码来源:mysql.php

示例6: mysql

include_once 'classes/class.pager.php';
$db = new mysql();
$pager = new paginator();
mysql_query("SET NAMES 'utf8'");
$currentPage = $_REQUEST["page"];
$pageLimit = 200;
if ($currentPage == 0) {
    $currentPage = 1;
}
$limitFrom = $pageLimit * $currentPage - $pageLimit;
switch ($_REQUEST['f']) {
    //Save category function
    case 'save_category':
        $save_category = $db->insert_sql("INSERT INTO categories (title) VALUES ('" . $_REQUEST['category_title'] . "')");
        echo "<option value=''>Select Category</option>";
        $category_sql = $db->select("SELECT title FROM categories ORDER BY title ASC");
        while ($category = mysql_fetch_object($category_sql)) {
            echo "<option value='" . $category->title . "'>" . $category->title . "</option>";
        }
        break;
        //Save location function
    //Save location function
    case 'save_location':
        $location = array();
        $location['location'] = $_REQUEST['location_title'];
        $location['city'] = $_REQUEST['city_title'];
        $db->insert_array("locations", $location);
        echo "<span class='location_res'></span>";
        break;
        //Get locations based on the city
    //Get locations based on the city
开发者ID:arshanam,项目名称:pharmacy_app,代码行数:31,代码来源:actionController.php

示例7: mysql

<?php

require 'msql.class.php';
// include mysql-class
$dbObj = new mysql('mysql.metropolia.fi', 'dineshs', 'password2043', 'dineshs');
// make an object from mysql-class
// make the connection
$dbObj->connect();
$dbObj->select();
?>
 
开发者ID:dinesh2043,项目名称:ecommere-sample,代码行数:10,代码来源:dbconnect.php

示例8: testSelect

 /**
  * @covers ITE\mysql::select
  */
 public function testSelect()
 {
     $this->assertCount(1, $this->object->select("log", "1=1", "log_id DESC LIMIT 1", false, false));
     $this->assertFalse($this->object->select("dummyTable", "1=1", "log_id DESC LIMIT 1", false, false));
 }
开发者ID:fran-diaz,项目名称:ite,代码行数:8,代码来源:mysqlTest.php


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