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


PHP DBAccess::exec方法代碼示例

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


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

示例1: 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);
開發者ID:vin100zz,項目名稱:mesautos,代碼行數:10,代碼來源:set-emblem-modele.php

示例2:

<?php

include_once "db.php";
$idModele = $_REQUEST["idModele"];
$mini = $_REQUEST["mini"];
// SQL
DBAccess::exec("UPDATE modele\n  SET mini = '{$mini}'\n  WHERE idModele = '{$idModele}'");
include_once "list-mini.php";
開發者ID:vin100zz,項目名稱:mesautos,代碼行數:8,代碼來源:update-mini.php

示例3: 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);
開發者ID:vin100zz,項目名稱:mesautos,代碼行數:31,代碼來源:update.php


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