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


PHP DBAccess::singleRow方法代码示例

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


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

示例1: json_encode

<?php 
include_once "db.php";
$idMarque = $_REQUEST["id"];
// SQL
$marque = DBAccess::singleRow("SELECT * FROM marque WHERE idMarque='{$idMarque}'");
$modeles = DBAccess::query("SELECT * FROM modele WHERE idMarque='{$idMarque}' ORDER BY ordre");
$documentsMarque = DBAccess::query("SELECT * FROM documentMarque WHERE idMarque='{$idMarque}' ORDER BY ordre");
foreach ($modeles as $id => $modele) {
    $idModele = $modele['idModele'];
    $modeles[$id]['idDocEmblematique'] = DBAccess::singleValue("\n\t\tSELECT idDocumentGamme\n\t\tFROM documentGamme, gamme, anneeModele\n\t\tWHERE documentGamme.idGamme=gamme.idGamme\n\t\t  AND gamme.idAnneeModele=anneeModele.idAnneeModele\n\t\t\tAND idModele='{$idModele}'\n\t\tORDER BY emblem_modele DESC\n\t");
}
$marque['modeles'] = $modeles;
$marque['docs'] = $documentsMarque;
$marque['categories'] = isset($categories) ? $categories : null;
$aText = "texte/marque/{$idMarque}.txt";
if (is_file($aText) && ($desc = implode(file($aText)))) {
    //$marque['histo'] = utf8_encode($desc);
    $marque['histo'] = $desc;
}
print json_encode($marque, JSON_PRETTY_PRINT);
开发者ID:vin100zz,项目名称:mesautos,代码行数:20,代码来源:marque.php

示例2: json_encode

<?php

include_once "db.php";
$idModele = $_REQUEST["id"];
// SQL
$marque = DBAccess::singleRow("SELECT * FROM marque WHERE idMarque=(SELECT idMarque FROM modele WHERE idModele='{$idModele}')");
$modele = DBAccess::singleRow("SELECT * FROM modele WHERE idModele='{$idModele}'");
$anneeModeles = DBAccess::query("SELECT * FROM anneeModele WHERE idModele='{$idModele}' ORDER BY annee");
foreach ($anneeModeles as $key => $anneeModele) {
    $anneeModeles[$key]['gammes'] = DBAccess::query("SELECT * FROM gamme WHERE idAnneeModele=" . $anneeModele['idAnneeModele']);
    foreach ($anneeModeles[$key]['gammes'] as $key2 => $gamme) {
        $anneeModeles[$key]['gammes'][$key2]['docs'] = DBAccess::query("SELECT * FROM documentGamme WHERE idGamme='" . $anneeModeles[$key]['gammes'][$key2]['idGamme'] . "' ORDER BY ordre, idDocumentGamme");
    }
}
$response = array();
$response['marque'] = $marque;
$response['modele'] = $modele;
$response['anneeModeles'] = $anneeModeles;
print json_encode($response, JSON_PRETTY_PRINT);
开发者ID:vin100zz,项目名称:mesautos,代码行数:19,代码来源:modele.php

示例3:

} else {
    if ($action == "edit") {
        if ($objet == "marque") {
            $result = DBAccess::singleRow("SELECT *\n\t\t\tFROM marque\n\t\t\tWHERE idMarque='{$id}'");
        } else {
            if ($objet == "modele") {
                $result = DBAccess::singleRow("SELECT *\n\t\t\tFROM modele\n\t\t\tJOIN marque on marque.idMarque = modele.idMarque\n\t\t\tWHERE idModele='{$id}'");
            } else {
                if ($objet == "gamme") {
                    $result = DBAccess::singleRow("SELECT *\n\t\t\tFROM gamme\n\t\t\tJOIN anneeModele on gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\tJOIN modele on anneeModele.idModele = modele.idModele\n\t\t\tJOIN marque on marque.idMarque = modele.idMarque\n\t\t\tWHERE idGamme='{$id}'");
                } else {
                    if ($objet == "docMarque") {
                        $result = DBAccess::singleRow("SELECT * FROM documentMarque WHERE idDocumentMarque='{$id}'");
                    } else {
                        if ($objet == "docGamme") {
                            $result = DBAccess::singleRow("SELECT *\n\t\t\tFROM documentGamme\n\t\t\tJOIN gamme on gamme.idGamme = documentGamme.idGamme\n\t\t\tJOIN anneeModele on gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\tJOIN modele on anneeModele.idModele = modele.idModele\n\t\t\tJOIN marque on marque.idMarque = modele.idMarque\n\t\t\tWHERE idDocumentGamme='{$id}'");
                        }
                    }
                }
            }
        }
    }
}
if ($objet == "marque") {
    $result['liste_pays'] = DBAccess::query("SELECT DISTINCT pays FROM marque");
    $result['modeles'] = DBAccess::query("SELECT * FROM modele WHERE idMarque = {$id} ORDER BY ordre");
} else {
    if ($objet == "modele") {
        $result['liste_categories'] = DBAccess::query("SELECT DISTINCT categorie FROM modele ORDER BY categorie");
        /*$result['versions'] = DBAccess::query
          (
开发者ID:vin100zz,项目名称:mesautos,代码行数:31,代码来源:saisie.php


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