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


PHP db_connect::prepare方法代码示例

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


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

示例1:

//a temp permission for the "are you logged in" gate (in prepend)
require_once "prepend.php";
require_once "common.php";
require_once "db_" . $_SESSION['_SITE_CONF']['DBMANAGER'] . ".php";
if (isset($_POST["btnSubmit"])) {
    //logging out
    throw_the_bum_out("Goodbye!", "Logout: by id=" . $_SESSION["person_id"]);
    //let prepend take care of it (not really a bum)
}
$organization = "";
$person = "";
if (isset($_SESSION["person_id"])) {
    //logged in
    $db = new db_connect($_SESSION['_SITE_CONF']['DBEDITOR']);
    $sql = "SELECT name FROM " . $db->prefix . "a00_organization WHERE organization_id=:org";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':org', $_SESSION["organization_id"], PDO::PARAM_INT);
    $stmt->execute();
    if (!($row = $stmt->fetchObject())) {
        $organization = "--No Organization--";
    } else {
        $organization = COM_output_edit($row->name);
    }
    $stmt->closeCursor();
    $sql = "SELECT firstname, lastname FROM " . $db->prefix . "c00_person WHERE person_id=:person";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(':person', $_SESSION["person_id"], PDO::PARAM_INT);
    $stmt->execute();
    $row = $stmt->fetchObject();
    $person = COM_output_edit($row->firstname . " " . $row->lastname);
    $stmt->closeCursor();
开发者ID:bbogin,项目名称:sr2s,代码行数:31,代码来源:head.php


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