本文整理汇总了PHP中DBAccess::singleValue方法的典型用法代码示例。如果您正苦于以下问题:PHP DBAccess::singleValue方法的具体用法?PHP DBAccess::singleValue怎么用?PHP DBAccess::singleValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBAccess
的用法示例。
在下文中一共展示了DBAccess::singleValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sqlproof
$nom = sqlproof($version["nom"]);
$query = "INSERT INTO gamme (type, nom, idAnneeModele) VALUES ('$type', '$nom', '$idAnneeModele')";
print($query . '<br/>');
DBAccess::exec($query);
}
*/
$docs = DBAccess::query("SELECT *\n\tFROM a_supprimer_documentVersion, a_supprimer_version\n\tWHERE a_supprimer_documentVersion.idVersion = a_supprimer_version.idVersion AND idModele=4\n");
foreach ($docs as $id => $doc) {
$idDocumentVersion = $doc["idDocumentVersion"];
$idModele = $doc["idModele"];
$anneeModele = sqlproof($doc["anneeModele"]);
$gamme = sqlproof($doc["type"]);
$nomGamme = sqlproof($doc["nom"]);
$ordre = sqlproof($doc["ordre"]);
$source = sqlproof($doc["source"]);
$date = sqlproof($doc["date"]);
$legende = sqlproof($doc["legende"]);
$idGamme = DBAccess::singleValue("SELECT idGamme\n\t\tFROM gamme, anneeModele\n\t\tWHERE gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\tAND annee = '{$anneeModele}'\n\t\t\tAND (type='{$gamme}' AND (nom<>'' AND nom='{$nomGamme}'))\n\t\t\tAND idModele = '{$idModele}'\n\t");
if (!$idGamme) {
$idGamme = DBAccess::singleValue("SELECT idGamme\n\t\t\tFROM gamme, anneeModele\n\t\t\tWHERE gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\t\tAND annee = '{$anneeModele}'\n\t\t\t\tAND (type='{$gamme}' AND nom='')\n\t\t\t\tAND idModele = '{$idModele}'\n\t\t");
if (!$idGamme) {
$idGamme = DBAccess::singleValue("SELECT idGamme\n\t\t\t\tFROM gamme, anneeModele\n\t\t\t\tWHERE gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\t\t\tAND annee = '{$anneeModele}'\n\t\t\t\t\tAND type='{$gamme}'\n\t\t\t\t\tAND idModele = '{$idModele}'\n\t\t\t");
if (!$idGamme) {
$idGamme = DBAccess::singleValue("SELECT idGamme\n\t\t\t\t\tFROM gamme, anneeModele\n\t\t\t\t\tWHERE gamme.idAnneeModele = anneeModele.idAnneeModele\n\t\t\t\t\t\tAND annee = '{$anneeModele}'\n\t\t\t\t\t\tAND nom='{$nomGamme}'\n\t\t\t\t\t\tAND idModele = '{$idModele}'\n\t\t\t\t");
}
}
}
$query = "INSERT INTO documentGamme (idDocumentGamme, idGamme, ordre, source, date, legende) VALUES ('{$idDocumentVersion}', '{$idGamme}', '{$ordre}', '{$source}', '{$date}', '{$legende}')";
print $query . '<br/>';
//DBAccess::exec($query);
}
示例2: json_encode
<?php
include_once "db.php";
$idDocument = $_REQUEST["id"];
// SQL
$idModele = DBAccess::singleValue("SELECT idModele\n FROM documentGamme, gamme, anneeModele\n WHERE documentGamme.idGamme=gamme.idGamme\n AND gamme.idAnneeModele = anneeModele.idAnneeModele\n AND idDocumentGamme='{$idDocument}'");
DBAccess::exec("UPDATE documentGamme\n SET emblem_modele=0\n WHERE idGamme IN\n (\n SELECT idGamme\n FROM gamme, anneeModele\n WHERE gamme.idAnneeModele = anneeModele.idAnneeModele\n AND idModele='{$idModele}'\n )");
DBAccess::exec("UPDATE documentGamme\n SET emblem_modele=1\n WHERE idDocumentGamme='{$idDocument}'");
$response = 'ok';
print json_encode($response, JSON_PRETTY_PRINT);
示例3: foreach
<?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);
示例4: getParam
$status['query'] = "UPDATE documentMarque\n\t\t\t\t\t\t\t\t\t\t\t\t SET idMarque='{$idMarque}', ordre='{$ordre}', source='{$source}', date='{$date}', legende='{$legende}', motCle='{$motCle}'\n\t\t\t\t\t\t\t\t\t\t\t\t WHERE idDocumentMarque = '{$idDocumentMarque}'";
}
} else {
if ($objet == "docGamme") {
$idGamme = getParam("idGamme");
$source = getParam("source");
$date = getParam("date");
$legende = getParam("legende");
$lien = getParam("lien");
if ($action == "add") {
$status['query'] = "INSERT INTO documentGamme(idGamme, source, date, legende, lien)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t VALUES('{$idGamme}', '{$source}', '{$date}', '{$legende}', '{$lien}')";
} else {
$idDocumentGamme = getParam("idDocumentGamme");
$status['query'] = "UPDATE documentGamme\n\t\t\t\t\t\t\t\t\t\t\t\t SET idGamme='{$idGamme}', source='{$source}', date='{$date}', legende='{$legende}', lien='{$lien}'\n\t\t\t\t\t\t\t\t\t\t\t\t WHERE idDocumentGamme = '{$idDocumentGamme}'";
}
}
}
}
}
}
$status['result'] = DBAccess::exec($status['query']) ? "ok" : "ko";
if ($action == "add") {
if ($objet == "docMarque") {
$status['new'] = DBAccess::singleValue("SELECT max(idDocumentMarque) as id FROM documentMarque");
} else {
if ($objet == "docGamme") {
$status['new'] = DBAccess::singleValue("SELECT max(idDocumentGamme) as id FROM documentGamme");
}
}
}
print json_encode($status, JSON_PRETTY_PRINT);