本文整理汇总了PHP中SC_Query::select方法的典型用法代码示例。如果您正苦于以下问题:PHP SC_Query::select方法的具体用法?PHP SC_Query::select怎么用?PHP SC_Query::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SC_Query
的用法示例。
在下文中一共展示了SC_Query::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lfGetCSVData
function lfGetCSVData()
{
global $arrAUTHORITY;
global $arrWORK;
$oquery = new SC_Query();
$cols = "authority,name,department,login_id,work";
$oquery->setwhere("del_flg <> 1");
$oquery->andwhere("member_id <> " . ADMIN_ID);
$oquery->setoption("ORDER BY rank DESC");
$list_data = $oquery->select($cols, "dtb_member");
$max = count($list_data);
for ($i = 0; $i < $max; $i++) {
$line = "";
$line .= "\"" . $arrAUTHORITY[$list_data[$i]['authority']] . "\",";
$tmp = ereg_replace("\"", "\"\"", $list_data[$i]['name']);
$line .= "\"" . $tmp . "\",";
$tmp = ereg_replace("\"", "\"\"", $list_data[$i]['department']);
$line .= "\"" . $tmp . "\",";
$tmp = ereg_replace("\"", "\"\"", $list_data[$i]['login_id']);
$line .= "\"" . $tmp . "\",";
$line .= "\"" . $arrWORK[$list_data[$i]['work']] . "\"\n";
$data .= $line;
}
$header = "\"権限\",\"名前\",\"所属\",\"ログインID\",\"稼働状況\"\n";
return $header . $data;
}
示例2: findProductIdsOrder
/**
* SC_Queryインスタンスに設定された検索条件を元に並び替え済みの検索結果商品IDの配列を取得する。
*
* 検索条件は, SC_Query::setWhere() 関数で設定しておく必要があります.
*
* @param SC_Query $objQuery SC_Query インスタンス
* @param array $arrVal 検索パラメーターの配列
* @return array 商品IDの配列
*/
public function findProductIdsOrder(&$objQuery, $arrVal = array())
{
$table = <<<__EOS__
dtb_products AS alldtl JOIN dtb_products_class AS P
ON P.product_id = alldtl.product_id
LEFT JOIN dtb_class AS A
ON P.classcategory_id1 = A.class_id
LEFT JOIN dtb_class AS B
ON P.classcategory_id2 = B.class_id
__EOS__;
$objQuery->setGroupBy('alldtl.product_id');
if (is_array($this->arrOrderData) and $objQuery->order == '') {
$o_col = $this->arrOrderData['col'];
$o_table = $this->arrOrderData['table'];
$o_order = $this->arrOrderData['order'];
$order = <<<__EOS__
(
SELECT {$o_col}
FROM
{$o_table} as T2
WHERE T2.product_id = alldtl.product_id
ORDER BY T2.{$o_col} {$o_order}
LIMIT 1
) {$o_order}, product_id
__EOS__;
$objQuery->setOrder($order);
}
$results = $objQuery->select('alldtl.product_id', $table, '', $arrVal, MDB2_FETCHMODE_ORDERED);
$resultValues = array();
foreach ($results as $val) {
$resultValues[] = $val[0];
}
return $resultValues;
}
示例3: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
global $objCampaignSess;
$objView = new SC_SiteView();
$objQuery = new SC_Query();
$objCampaignSess = new SC_CampaignSession();
// キャンペーンからの登録の場合の処理
if ($_GET["cp"] != "") {
$arrCampaign = $objQuery->select("directory_name", "dtb_campaign", "campaign_id = ?", array($_GET["cp"]));
// キャンペーンディレクトリ名を保持
$dir_name = $arrCampaign[0]['directory_name'];
} else {
$dir_name = "";
}
// レイアウトデザインを取得
$helper = new SC_Helper_PageLayout_Ex();
$helper->sfGetPageLayout($this, false, DEF_LAYOUT);
$objView->assignobj($this);
// フレームを選択(キャンペーンページから遷移なら変更)
if ($this->dir_name != "") {
$objView->display(CAMPAIGN_TEMPLATE_PATH . $dir_name . "/active/site_frame.tpl");
$objCampaignSess->delCampaign();
} else {
$objView->display(SITE_FRAME);
}
}
示例4: getRanking
function getRanking()
{
$objQuery = new SC_Query();
$col = "T1.product_id, T1.product_name as name,COUNT(*) AS order_count ";
$from = "dtb_order_detail AS T1\r\n INNER JOIN dtb_order AS T2 ON T1.order_id = T2.order_id\r\n INNER JOIN dtb_products AS T3 ON T1.product_id = T3.product_id";
$objQuery->setgroupby("T1.product_id,T1.product_name");
$objQuery->setorder("order_count DESC");
$objQuery->setlimit(10);
//var_dump($objQuery->setorder("order_count DESC"));
return $objQuery->select($col, $from, 'T2.status = ?', array('5'));
}
示例5: sfSessRead
/**
* セッションのデータををDBから読み込む.
*
* @param string $id セッションID
* @return string セッションデータの値
*/
function sfSessRead($id)
{
if (!$this->objDb->sfTabaleExists("dtb_session")) {
return '';
}
$objQuery = new SC_Query();
$arrRet = $objQuery->select("sess_data", "dtb_session", "sess_id = ?", array($id));
if (empty($arrRet)) {
return '';
} else {
return $arrRet[0]['sess_data'];
}
}
示例6: testGetMasterData
/**
* SC_DB_MasterData::getMasterData() のテストケース
*/
function testGetMasterData()
{
$columns = array('id', 'name', 'rank');
$masterData = new SC_DB_MasterData_Ex();
$actual = $masterData->getMasterData('mtb_pref', $columns);
$objQuery = new SC_Query();
$objQuery->setorder($columns[2]);
$results = $objQuery->select($columns[0] . ", " . $columns[1], 'mtb_pref');
$expected = array();
foreach ($results as $result) {
$expected[$result[$columns[0]]] = $result[$columns[1]];
}
$this->assertEquals($expected, $actual);
}
示例7: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objView = new SC_AdminView();
$objSess = new SC_Session();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
if (SC_Utils_Ex::sfIsInt($_GET['send_id'])) {
$objQuery = new SC_Query();
$col = "subject, mail_body";
$where = "send_id = ?";
$arrRet = $objQuery->select($col, "dtb_mail_history", $where, array($_GET['send_id']));
$this->tpl_subject = $arrRet[0]['subject'];
$this->tpl_body = $arrRet[0]['mail_body'];
}
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
示例8: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$objView = new SC_SiteView();
$objCartSess = new SC_CartSession("", false);
$objDb = new SC_Helper_DB_Ex();
// 管理ページからの確認の場合は、非公開の商品も表示する。
if (isset($_GET['admim']) && $_GET['admin'] == 'on') {
$where = "del_flg = 0";
} else {
$where = "del_flg = 0 AND status = 1";
}
// 値の正当性チェック
if (!SC_Utils_Ex::sfIsInt($_GET['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_GET['product_id'], $where)) {
SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
}
$image_key = $_GET['image'];
$objQuery = new SC_Query();
// カラムが存在していなければエラー画面を表示
if (!$objDb->sfColumnExists("dtb_products", $image_key)) {
SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);
}
$col = "name, {$image_key}";
$arrRet = $objQuery->select($col, "dtb_products", "product_id = ?", array($_GET['product_id']));
$image_path = IMAGE_SAVE_DIR . $arrRet[0][$image_key];
if (file_exists($image_path)) {
list($width, $height) = getimagesize($image_path);
} else {
$width = 0;
$height = 0;
}
$this->tpl_width = $width;
$this->tpl_height = $height;
$this->tpl_table_width = $this->tpl_width + 20;
$this->tpl_table_height = $this->tpl_height + 20;
$this->tpl_image = $arrRet[0][$image_key];
$this->tpl_name = $arrRet[0]['name'];
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
示例9: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
$conn = new SC_DBConn();
$objView = new SC_AdminView();
$objSess = new SC_Session();
$objDb = new SC_Helper_DB_Ex();
// 認証可否の判定
SC_Utils_Ex::sfIsSuccess($objSess);
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
if ($_POST['mode'] == "search") {
// POST値の引き継ぎ
$this->arrForm = $_POST;
// 入力文字の強制変換
$this->lfConvertParam();
$where = "del_flg = 0 AND status = 1";
/* 入力エラーなし */
foreach ($this->arrForm as $key => $val) {
if ($val == "") {
continue;
}
switch ($key) {
case 'search_name':
$where .= " AND name ILIKE ?";
$arrval[] = "%{$val}%";
break;
case 'search_category_id':
list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val);
if ($tmp_where != "") {
$where .= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")";
$arrval = array_merge((array) $arrval, (array) $tmp_arrval);
}
break;
case 'search_product_code':
$where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)";
$arrval[] = "{$val}%";
break;
default:
break;
}
}
$order = "update_date DESC, product_id DESC";
// 読み込む列とテーブルの指定
$col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited";
$from = "vw_products_nonclass AS noncls ";
$objQuery = new SC_Query();
// 行数の取得
if (empty($arrval)) {
$arrval = array();
}
$linemax = $objQuery->count("dtb_products", $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (isset($_POST['search_page_max']) && is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX);
$this->tpl_strnavi = $objNavi->strnavi;
// 表示文字列
$startno = $objNavi->start_row;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
// 検索結果の取得
$this->arrProducts = $objQuery->select($col, $from, $where, $arrval);
}
// カテゴリ取得
$this->arrCatList = $objDb->sfGetCategoryList();
//---- ページ表示
$objView->assignobj($this);
$objView->display($this->tpl_mainpage);
}
示例10: lfSetNewAddr
function lfSetNewAddr($uniqid, $customer_id)
{
$objQuery = new SC_Query();
$diff = false;
$find_same = false;
$col = "deliv_name01,deliv_name02,deliv_kana01,deliv_kana02,deliv_tel01,deliv_tel02,deliv_tel03,deliv_zip01,deliv_zip02,deliv_pref,deliv_addr01,deliv_addr02";
$where = "order_temp_id = ?";
$arrRet = $objQuery->select($col, "dtb_order_temp", $where, array($uniqid));
// 要素名のdeliv_を削除する。
foreach ($arrRet[0] as $key => $val) {
$keyname = ereg_replace("^deliv_", "", $key);
$arrNew[$keyname] = $val;
}
// 会員情報テーブルとの比較
$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
$where = "customer_id = ?";
$arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($customer_id));
// 会員情報の住所と異なる場合
if ($arrNew != $arrCustomerAddr[0]) {
// 別のお届け先テーブルの住所と比較する
$col = "name01,name02,kana01,kana02,tel01,tel02,tel03,zip01,zip02,pref,addr01,addr02";
$where = "customer_id = ?";
$arrOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($customer_id));
foreach ($arrOtherAddr as $arrval) {
if ($arrNew == $arrval) {
// すでに同じ住所が登録されている
$find_same = true;
}
}
if (!$find_same) {
$diff = true;
}
}
// 新しいお届け先が登録済みのものと異なる場合は別のお届け先テーブルに登録する
if ($diff) {
$sqlval = $arrNew;
$sqlval['customer_id'] = $customer_id;
$objQuery->insert("dtb_other_deliv", $sqlval);
}
}
示例11: getPublicKey
function getPublicKey()
{
$objQuery = new SC_Query();
$arrRet = $objQuery->select('*', 'dtb_ownersstore_settings');
return isset($arrRet[0]['public_key']) ? $arrRet[0]['public_key'] : null;
}
示例12: process
/**
* Page のプロセス.
*
* @return void
*/
function process()
{
//---- ページ初期設定
$objQuery = new SC_Query();
$objView = new SC_AdminView();
$objDate = new SC_Date(1901);
$objDb = new SC_Helper_DB_Ex();
$this->arrYear = $objDate->getYear();
// 日付プルダウン設定
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$this->objDate = $objDate;
// 認証可否の判定
$objSess = new SC_Session();
SC_Utils_Ex::sfIsSuccess($objSess);
// POST値の引き継ぎ
$this->arrForm = $_POST;
// ページ送り用
$this->arrHidden['search_pageno'] = isset($_POST['search_pageno']) ? $_POST['search_pageno'] : "";
// 検索ワードの引き継ぎ
foreach ($_POST as $key => $val) {
switch ($key) {
case 'sex':
case 'status':
$this->arrHidden[$key] = SC_Utils_Ex::sfMergeParamCheckBoxes($val);
if (!is_array($val)) {
$this->arrForm[$key] = split("-", $val);
}
break;
default:
$this->arrHidden[$key] = $val;
break;
}
}
if (!isset($_POST['mode'])) {
$_POST['mode'] = "";
}
// 顧客削除
if ($_POST['mode'] == "delete") {
$sql = "SELECT status,email FROM dtb_customer WHERE customer_id = ? AND del_flg = 0";
$result_customer = $objQuery->conn->getAll($sql, array($_POST["edit_customer_id"]));
if ($result_customer[0]["status"] == 2) {
//本会員削除
$arrDel = array("del_flg" => 1, "update_date" => "NOW()");
$objQuery->conn->autoExecute("dtb_customer", $arrDel, "customer_id = " . SC_Utils_Ex::sfQuoteSmart($_POST["edit_customer_id"]));
} elseif ($result_customer[0]["status"] == 1) {
//仮会員削除
$sql = "DELETE FROM dtb_customer WHERE customer_id = ?";
$objQuery->conn->query($sql, array($_POST["edit_customer_id"]));
}
}
//if ($_POST['mode'] == "search" || $_POST['mode'] == "csv" || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all") {
// 登録メール再送
if ($_POST['mode'] == "resend_mail") {
$arrRet = $objQuery->select("name01, name02, secret_key, email", "dtb_customer", "customer_id = ? AND del_flg <> 1 AND status = 1", array($_POST["edit_customer_id"]));
if (is_array($arrRet) === true && count($arrRet) > 0) {
$CONF = $objDb->sf_getBasisData();
$this->CONF = $CONF;
$objMailText = new SC_SiteView();
$objMailText->assignobj($this);
$mailHelper = new SC_Helper_Mail_Ex();
$this->name01 = $arrRet[0]['name01'];
$this->name02 = $arrRet[0]['name02'];
$this->uniqid = $arrRet[0]['secret_key'];
$subject = $mailHelper->sfMakesubject($objQuery, $objMailText, $this, '会員登録のご確認');
$toCustomerMail = $objMailText->fetch("mail_templates/customer_mail.tpl");
$objMail = new SC_SendMail();
$objMail->setItem('', $subject, $toCustomerMail, $CONF["email03"], $CONF["shop_name"], $CONF["email03"], $CONF["email04"], $CONF["email04"]);
// 宛先の設定
$name = $this->name01 . $this->name02 . " 様";
$objMail->setTo($arrRet[0]["email"], $name);
$objMail->sendMail();
}
}
if ($_POST['mode'] == "search" || $_POST['mode'] == "csv" || $_POST['mode'] == "delete" || $_POST['mode'] == "delete_all" || $_POST['mode'] == "resend_mail") {
// 入力文字の強制変換
$this->lfConvertParam();
// エラーチェック
$this->arrErr = $this->lfCheckError($this->arrForm);
$where = "del_flg = 0";
/* 入力エラーなし */
if (count($this->arrErr) == 0) {
//-- 検索データ取得
$objSelect = new SC_CustomerList($this->arrForm, "customer");
// 表示件数設定
$page_rows = $this->arrForm['page_rows'];
if (is_numeric($page_rows)) {
$page_max = $page_rows;
} else {
$page_max = SEARCH_PMAX;
}
if (!isset($this->arrForm['search_pageno'])) {
$this->arrForm['search_pageno'] = "";
}
if ($this->arrForm['search_pageno'] == 0) {
//.........这里部分代码省略.........
示例13: lfGetNews
/**
* 新着情報を取得する
*
* @param SC_Query $objQuery DB操作クラス
* @return array $arrNews 取得結果を配列で返す
*/
function lfGetNews(&$objQuery)
{
$col = "";
$col .= "news_id ";
// 新着情報ID
$col .= ",news_title ";
// 新着情報タイトル
$col .= ",news_comment ";
// 新着情報本文
$col .= ",news_date ";
// 日付
$col .= ",news_url ";
// 新着情報URL
$col .= ",news_select ";
// 新着情報の区分(1:URL、2:本文)
$col .= ",(SELECT shop_name FROM dtb_baseinfo limit 1) AS shop_name ";
// 店名
$col .= ",(SELECT email04 FROM dtb_baseinfo limit 1) AS email ";
// 代表Emailアドレス
$from = "dtb_news";
$where = "del_flg = '0'";
$order = "rank DESC";
$objQuery->setOrder($order);
$arrNews = $objQuery->select($col, $from, $where);
// RSS用に変換
foreach (array_keys($arrNews) as $key) {
$netUrlHttpUrl = new Net_URL(HTTP_URL);
$row =& $arrNews[$key];
// 日付
$row['news_date'] = date('r', strtotime($row['news_date']));
// 新着情報URL
if (SC_Utils_Ex::isBlank($row['news_url'])) {
$row['news_url'] = HTTP_URL;
} elseif ($row['news_url'][0] == '/') {
// 変換(絶対パス→URL)
$netUrl = new Net_URL($row['news_url']);
$netUrl->protocol = $netUrlHttpUrl->protocol;
$netUrl->user = $netUrlHttpUrl->user;
$netUrl->pass = $netUrlHttpUrl->pass;
$netUrl->host = $netUrlHttpUrl->host;
$netUrl->port = $netUrlHttpUrl->port;
$row['news_url'] = $netUrl->getUrl();
}
}
return $arrNews;
}
示例14: lfGetData
function lfGetData($payment_id)
{
$objQuery = new SC_Query();
$where = "payment_id = ?";
$arrRet = $objQuery->select("*", "dtb_payment", $where, array($payment_id));
return $arrRet[0];
}
示例15: process
//.........这里部分代码省略.........
$arrval[] = $date;
break;
case 'search_ebirthyear':
$date = SC_Utils_Ex::sfGetTimestamp($_POST['search_ebirthyear'], $_POST['search_ebirthmonth'], $_POST['search_ebirthday'], true);
$where .= " AND order_birth <= ?";
$arrval[] = $date;
break;
case 'search_order_status':
$where .= " AND status = ?";
$arrval[] = $val;
break;
default:
if (!isset($arrval)) {
$arrval = array();
}
break;
}
}
$order = "update_date DESC";
switch ($_POST['mode']) {
case 'csv':
require_once CLASS_EX_PATH . "helper_extends/SC_Helper_CSV_Ex.php";
$objCSV = new SC_Helper_CSV_Ex();
// オプションの指定
$option = "ORDER BY {$order}";
// CSV出力タイトル行の作成
$arrCsvOutput = SC_Utils_Ex::sfSwapArray($objCSV->sfgetCsvOutput(3, " WHERE csv_id = 3 AND status = 1"));
if (count($arrCsvOutput) <= 0) {
break;
}
$arrCsvOutputCols = $arrCsvOutput['col'];
$arrCsvOutputTitle = $arrCsvOutput['disp_name'];
$head = SC_Utils_Ex::sfGetCSVList($arrCsvOutputTitle);
$data = $objCSV->lfGetCSV("dtb_order", $where, $option, $arrval, $arrCsvOutputCols);
// CSVを送信する。
SC_Utils_Ex::sfCSVDownload($head . $data);
exit;
break;
case 'pdf':
$objFpdf = new SC_Fpdf(1, '納品書');
$objFpdf->setData($arrRet);
$objFpdf->createPdf();
break;
case 'delete_all':
// 検索結果をすべて削除
$sqlval['del_flg'] = 1;
$objQuery = new SC_Query();
$objQuery->update("dtb_order", $sqlval, $where, $arrval);
break;
default:
// 読み込む列とテーブルの指定
$col = "*";
$from = "dtb_order";
$objQuery = new SC_Query();
// 行数の取得
$linemax = $objQuery->count($from, $where, $arrval);
$this->tpl_linemax = $linemax;
// 何件が該当しました。表示用
// ページ送りの処理
if (is_numeric($_POST['search_page_max'])) {
$page_max = $_POST['search_page_max'];
} else {
$page_max = SEARCH_PMAX;
}
// ページ送りの取得
$objNavi = new SC_PageNavi($this->arrHidden['search_pageno'], $linemax, $page_max, "fnNaviSearchPage", NAVI_PMAX);
$startno = $objNavi->start_row;
$this->arrPagenavi = $objNavi->arrPagenavi;
// 取得範囲の指定(開始行番号、行数のセット)
$objQuery->setlimitoffset($page_max, $startno);
// 表示順序
$objQuery->setorder($order);
// 検索結果の取得
$this->arrResults = $objQuery->select($col, $from, $where, $arrval);
}
}
break;
default:
break;
}
$objDate = new SC_Date();
// 登録・更新日検索用
$objDate->setStartYear(RELEASE_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrRegistYear = $objDate->getYear();
// 生年月日検索用
$objDate->setStartYear(BIRTH_YEAR);
$objDate->setEndYear(DATE("Y"));
$this->arrBirthYear = $objDate->getYear();
// 月日の設定
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
// 入力値の取得
$this->arrForm = $this->objFormParam->getFormParamList();
// 支払い方法の取得
$arrRet = $objDb->sfGetPayment();
$this->arrPayment = SC_Utils_Ex::sfArrKeyValue($arrRet, 'payment_id', 'payment_method');
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
}