• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP getPDO函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中getPDO函数的典型用法代码示例。如果您正苦于以下问题:PHP getPDO函数的具体用法?PHP getPDO怎么用?PHP getPDO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getCommentsForPost

/**
 * Returns the comments for the specified post.
 * @param integer $postId
 * @return array
 */
function getCommentsForPost($postId)
{
    $pdo = getPDO();
    $stmt = $pdo->prepare('SELECT id, name, text, created_at, website FROM comment WHERE post_id = :post_id');
    $stmt->execute(array('post_id' => $postId));
    return $stmt->fetchAll(PDO::FETCH_ASSOC);
}
开发者ID:SanketDG,项目名称:php-blog,代码行数:12,代码来源:common.php


示例2: testInit

function testInit()
{
    $pdo = getPDO('test');
    $pdo->beginTransaction();
    $pdo->query('DELETE FROM CheckinLogs');
    $pdo->commit();
}
开发者ID:shimizu9128,项目名称:nfcCheckin,代码行数:7,代码来源:nfcCheckinMain.php


示例3: getPageByRoute

function getPageByRoute($route) : array
{
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT title, content FROM pages WHERE route = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    return $stmt->fetch();
}
开发者ID:brunowerneck,项目名称:PHPFoundation,代码行数:8,代码来源:functions.php


示例4: renderPage

function renderPage($route)
{
    $page = empty($route) ? 'home' : $route;
    $pdo = getPDO();
    $stmt = $pdo->prepare("SELECT titulo, conteudo FROM Paginas WHERE rota = :route");
    $stmt->bindParam(":route", $route);
    $stmt->execute();
    $pagina = $stmt->fetch();
    require_once __DIR__ . "/Pages/{$page}.php";
}
开发者ID:birah-cursos-code-education,项目名称:FixtureExample,代码行数:10,代码来源:functions.php


示例5: queryOgID

/**
 * Query all the ID of organisms.
 * @return Array
 */
function queryOgID()
{
    $pdo = getPDO();
    try {
        $sql = 'select organismid from reference';
        $ps = $pdo->prepare($sql);
        $ps->execute();
        $ps->setFetchMode(PDO::FETCH_ASSOC);
        $result = $ps->fetchAll();
    } catch (Exception $ex) {
        $error = 'An Error has occurred in data accessing.';
        exit;
    }
    return $result;
}
开发者ID:ycduan,项目名称:UESTC_Software2015,代码行数:19,代码来源:organismDA.php


示例6: session_start

<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$threadSha = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($threadSha["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_THREAD_DELEATE_FLAG"]);
updeateToDeleatFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_RES_DELEATE_FLAG"]);
$jsonData = json_encode($threadSha);
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
die;
开发者ID:pecodrive,项目名称:stealsystem,代码行数:25,代码来源:deleteajax.php


示例7: dirname

<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
$queryList = getSQLQuery(getPDO());
$menuList = getMenuListForProcOrder(getPDO(), $queryList["SELECT_MENU_FOR_PROCORDER"]);
$menuData = getProced(getPDO(), $menuList);
$threadList = getThreadListUrl($menuData["menu_url"], getDiFix(getPDO(), "threadListUrlSuffix", $menuData["kind"], $queryList["SELECT_DIFIX"]));
var_dump($menuData);
var_dump(getUa(getPDO(), $queryList["SELECT_UA"]));
var_dump(getHost($menuData["menu_url"]));
$html = threadSteal(getPDO(), "133.130.96.221", "threadSteal", $threadList, $queryList["INSERT_IP_ACCESS"], getUa(getPDO(), $queryList["SELECT_UA"]), getHost($menuData["menu_url"]));
var_dump($html);
开发者ID:pecodrive,项目名称:stealsystem,代码行数:12,代码来源:ddddd.php


示例8: setUpBeforeClass

 static function setUpBeforeClass()
 {
     $pdo = self::$pdo = getPDO('test');
 }
开发者ID:shimizu9128,项目名称:nfcCheckin,代码行数:4,代码来源:CheckinLogMapperTest.php


示例9: deleteUserSettingsForDomain

 /**
  * Deletes a user setting domain
  *
  * @param string $userId
  *           User ID
  * @param string $domain
  *           Specific domain of settings i.e. workspace or the settings for a
  *           specific module
  * @throws PDOException
  * @return array array of Properties objects
  */
 public function deleteUserSettingsForDomain($userId, $domain)
 {
     try {
         // Had NotORM issues with this, not sure why so just used PDO (mattg)
         $pdo = getPDO();
         $sql = "DELETE FROM user_settings WHERE `userId` = :userId AND `domain` = :domain";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:25,代码来源:UserServicePDO.php


示例10: getResArray

            $resData = getResArray(getDiRegex(getPDO(), "resStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, $value["thread_sha"]);
            if (!$resData) {
                continue;
            }
            $ankaerLinkProced = resBodyAnkaerLinkProc($resData, getDiRegex(getPDO(), "resBodyAnkaerLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]));
            if ($menuData["kind"] === "open2ch.net") {
                $imgLinkProced = resBodyImgLinkProcO(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            } else {
                $imgLinkProced = resBodyImgLinkProc(getPDO(), $ankaerLinkProced, $value["thread_sha"], getDiRegex(getPDO(), "resBodyImgLinkStealRegex", $menuData["kind"], $queryList["SELECT_DIREGEX"]), $queryList["UPDATE_THREAD_IS_IMG"], $fixedList["imgDirUrl"], $menuData["kind"]);
            }
            $censoredProced = censorShipForRes($imgLinkProced, $censorList);
            // $net_or_sc_kind = kindChecher($censoredProced[0]["res_id"]);
            $net_or_sc_kind = "null";
            $resDataArray = resDataReArray($censoredProced, $net_or_sc_kind, $menuData["kind"]);
            resInsert(getPDO(), $resDataArray, $menuData["kind"], $queryList["INSERT_RES"]);
            threadUpdateTonet_or_sc(getPDO(), $net_or_sc_kind, $value["thread_sha"], $queryList["UPDATE_THREAD_NET_OR_SC"]);
            $countOfResDataArray = count($resDataArray);
            //MAX RES number.
            threadUpdateToRes_end(getPDO(), $value["thread_sha"], $countOfResDataArray, $queryList["UPDATE_THREAD_RES_END"]);
            unset($isoldLog, $resData, $resDataArray, $censoredProced, $imgLinkProced, $ankaerLinkProced, $encodiedResBaseHtml, $resStealBool, $countOfResDataArray, $net_or_sc_kind);
            $i++;
        }
        unset($value, $threadData);
    }
}
memoryPeakUse("end");
timeTest("ProcEnd");
$proc_time = timeView();
procRecode(getPDO(), $menuData["id"], $menuData["menu_title"], $proc_time, $menuData["kind"], $tags["end"], $queryList["INSERT_PROC_RECODE"]);
procUnLocking(getPDO());
开发者ID:pecodrive,项目名称:stealsystem,代码行数:30,代码来源:thread.php


示例11: dirname

<?php

require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
// $encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/l50", $queryList["INSERT_IP_ACCESS"]);
// var_dump($encodiedResBaseHtml);
$encodiedResBaseHtml = resSteal(getPDO(), "133.130.96.221", "resSteal", "http://awabi.open2ch.net/test/read.cgi/akb/1448519334/", $queryList["INSERT_IP_ACCESS"]);
// $encodiedResBaseHtml = file_get_contents("./imghtml.html");
$resData = getResArray(getDiRegex(getPDO(), "resStealRegex", "open2ch.net", $queryList["SELECT_DIREGEX"]), $encodiedResBaseHtml, "000000000000000");
$data = resBodyImgLinkProc(getPDO(), $resData, $threadSha, $regexList["ExresBodyImgLinkStealRegex"], $queryList["SELECT_RES"], $fixedList["imgSavePath"], "open2ch.net");
var_dump($data);
// $html = file_get_contents("http://hayabusa.open2ch.net/test/read.cgi/livejupiter/1449141846/l50");
// $regexBase = "/<?[div\sclass=\"imgur]*>?<a.+><img.*data-original=\"(.+)\"\s.+>[<br.>]*<\/a><?[\/div\n]*>?/u";
// $regexImg = "/<img.+data-original=\"(.+)\"\s.+>/u";
// preg_match_all($regexBase, $html, $match, PREG_SET_ORDER);
// $splitArray = [];
//
// foreach ($match as $value) {
//     $splitArray[] = preg_replace("/<\/div>/", "</div>\n", $value);
// }
//
// $imgAllay = [];
// foreach ($splitArray as $value) {
//     preg_match_all($regexBase, $value[0], $imgUrl, PREG_SET_ORDER);
//     $imgAllay[] = $imgUrl;
// }
开发者ID:pecodrive,项目名称:stealsystem,代码行数:31,代码来源:imgtest.php


示例12: dirname

}
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$request = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($request["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
$resData = getResData(getPDO(), $request["thread_sha"], $queryList["SELECT_RES"]);
$sortedResData = sortResByAnkaer($resData);
$threadData = getThreadDataBySha(getPDO(), $request["thread_sha"], $queryList["SELECT_THREAD_BY_THREADSHA"]);
$menuData = getMenuDefaultName(getPDO(), $threadData["menu_id"], $queryList["SELECT_MENU_FOR_MENUID"]);
$html = "";
$resSha = null;
$name = $menuData ? $menuData : "名無しさん";
$countOfSortedResData = count($sortedResData);
for ($k = 0; $k < $countOfSortedResData; $k++) {
    $resMasterID = $sortedResData[0]["res_id"];
    $resSha[] = $sortedResData[$k]["res_sha"];
    $html .= "<span class=\"{$sortedResData[$k]["thread_sha"]} {$sortedResData[$k]["res_sha"]} rename\">";
    $html .= "<span>{$sortedResData[$k]["res_no"]} : </span>";
    $html .= "<span><input type=\"text\" name={$sortedResData[$k]["res_sha"]} size=40 value=\"{$name}\"> : </span>";
    $html .= "<span>{$sortedResData[$k]["res_date"]}</span>";
    $html .= "<span>{$sortedResData[$k]["res_clock"]}</span>";
    if ($sortedResData[$k]["res_id"] === $resMasterID) {
        $html .= "<span class=\"resmaster\">{$sortedResData[$k]["res_id"]}</span>";
    } else {
开发者ID:pecodrive,项目名称:stealsystem,代码行数:31,代码来源:resajax.php


示例13: popTopicEvents

 public function popTopicEvents($userId, $topic)
 {
     try {
         $events = AppUtils::dbToArray($this->db->event_queue()->where("userId=? AND topic=?", $userId, $topic));
         $pdo = getPDO();
         $sql = "DELETE FROM event_queue WHERE `userId` = :userId AND `topic` = :topic";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':userId', $userId, PDO::PARAM_STR);
         $stmt->bindParam(':topic', $topic, PDO::PARAM_STR);
         $stmt->execute();
         return $events;
     } catch (PDOException $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:15,代码来源:EventServicePDO.php


示例14: deleteAllDomain

 /**
  * Delete a setting with specified domain name and setting key
  *
  * @param string $domain
  *           Domain name
  * @throws Exception
  */
 public function deleteAllDomain($domain)
 {
     try {
         $pdo = getPDO();
         $sql = "DELETE FROM system_setting WHERE `domain` = :domainId";
         $stmt = $pdo->prepare($sql);
         $stmt->bindParam(':domainId', $domain, PDO::PARAM_STR);
         $stmt->execute();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:19,代码来源:SettingsServicePDO.php


示例15: session_start

<?php

session_start();
require 'config.php';
require 'password.php';
require 'functions/area.fn.php';
require 'functions/areaPriority.fn.php';
require 'functions/brand.fn.php';
require 'functions/database.fn.php';
require 'functions/priority.fn.php';
require 'functions/priorityTheme.fn.php';
require 'functions/theme.fn.php';
require 'functions/user.fn.php';
$db = getPDO($database);
开发者ID:RGLong,项目名称:draft_kosmes,代码行数:14,代码来源:autoload.php


示例16: queryCegBaseByAccessNum

/**
 * Query all of data which belong to one gene cluster in ceg_base table.
 * @param type String $accessNum
 * @return Array
 */
function queryCegBaseByAccessNum($accessNum)
{
    $pdo = getPDO();
    try {
        $sql = "select * from ceg_base where access_num = :access_num";
        $ps = $pdo->prepare($sql);
        $ps->bindValue(":access_num", $accessNum);
        $ps->execute();
        $ps->setFetchMode(PDO::FETCH_ASSOC);
        $result = $ps->fetchAll();
    } catch (Exception $ex) {
        $error = "An Error has occurred in data accessing.";
        exit;
    }
    return $result;
}
开发者ID:ycduan,项目名称:UESTC_Software2015,代码行数:21,代码来源:cegRecordDA.php


示例17: session_start

<?php

session_start();
if (!isset($_SESSION["USERID"])) {
    header("Location: logout.php");
    exit;
}
// require_once(dirname(__file__) . '/functions.php');
require_once dirname(dirname(dirname(__FILE__))) . '/functions.php';
require_once dirname(dirname(__FILE__)) . '/wp-load.php';
$threadSha = json_decode(file_get_contents("php://input"), true);
if (!wp_verify_nonce($threadSha["nonce"])) {
    die;
}
date_default_timezone_set('Asia/Tokyo');
$queryList = getSQLQuery(getPDO());
$censorList = getCensorList(getPDO(), $queryList["SELECT_CENSOR"]);
$regexList = getRegex(getPDO(), $queryList["SELECT_REGEX"]);
$fixedList = getFix(getPDO(), $queryList["SELECT_FIX"]);
updeateToSuspendFlag(getPDO(), $threadSha["thread_sha"], $queryList["UPDATE_THREAD_SUSPEND_FLAG"]);
$jsonData = json_encode($threadSha);
header("Content-Type: text/html; X-Content-Type-Options: nosniff; charset=utf-8");
echo $jsonData;
die;
开发者ID:pecodrive,项目名称:stealsystem,代码行数:24,代码来源:suspendajax.php


示例18: getPostOverviews

 /**
  * Returns the forum posting overviews that are used on the overview
  * screen of the UI.
  * The key additions to the forum list in the
  * method is that there is an isMember flag added so that it can be
  * determined if
  * join requests links will be displayed. Also forums that do not have any
  * posts will not be returned depending on whether a LEFT JOIN is used.
  *
  * Summary is
  * Number of posts, posting day range, summary of most recent post.
  *
  * @throws PDOException
  * @return mixed The post summary object
  */
 public function getPostOverviews($userId)
 {
     // NOTE: If you want all the the forum not just the ones with posts
     // USE 'LEFT JOIN forum_post p' instead of 'JOIN forum_post p'
     $sql = "SELECT f.*, NOT(ISNULL(u.userId)) as isMember,\n      DATEDIFF(max(p.postDate),min(p.postDate))+1 AS numDays,\n      count(p.title) as numPosts\n      FROM forum f\n      LEFT JOIN forum_user u\n      ON (f.id = u.forumId AND u.userId = :userId)\n      JOIN forum_post p\n      ON (f.id = p.forumId)\n      GROUP BY f.id";
     try {
         $db = getPDO();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("userId", $userId);
         $stmt->execute();
         $forums = (array) $stmt->fetchAll(PDO::FETCH_ASSOC);
         //          $sql2 = "SELECT * FROM forum_post
         //                      WHERE forumId = :forumId
         //                      AND postDate = (SELECT MAX(fp2.postDate)
         //                      FROM forum_post fp2 WHERE fp2.forumId = :forumId2)";
         $sql2 = "SELECT * FROM forum_post\n                     WHERE forumId = :forumId\n                     ORDER BY postDate DESC";
         $stmt2 = $db->prepare($sql2);
         foreach ($forums as &$forum) {
             $isFirstPost = true;
             $forum['otherPosts'] = [];
             $stmt2->bindParam("forumId", $forum['id']);
             $stmt2->execute();
             $posts = (array) $stmt2->fetchAll(PDO::FETCH_ASSOC);
             foreach ($posts as &$post) {
                 $post['truncated'] = false;
                 if ($isFirstPost) {
                     $isFirstPost = false;
                     if (strlen($post['content']) > SELF::OVERVIEW_MAXLEN) {
                         $post['content'] = substr($post['content'], 0, SELF::OVERVIEW_MAXLEN);
                         $post['content'] = $post['content'] . ' .....';
                         $post['truncated'] = true;
                     }
                     $forum['mostRecentPost'] = $post;
                 } else {
                     unset($post['content']);
                     $forum['otherPosts'][] = $post;
                 }
             }
             /*
                         $recentSql = "SELECT * FROM forum_post
                                  WHERE forumId = :forumId
                                  AND postDate = (SELECT MAX(fp2.postDate)
                                  FROM forum_post fp2 WHERE fp2.forumId = :forumId2)";
                         
                         $stmt2 = $db->prepare($recentSql);
                         $stmt2->bindParam("forumId", $forums[$i]['id']);
                         $stmt2->bindParam("forumId2", $forums[$i]['id']);
                         $stmt2->execute();
                         $recent = (array) $stmt2->fetchAll(PDO::FETCH_ASSOC);
                         if (isset($recent) && count($recent) > 0)
                         {
                            $post = $recent[0];
                            $post['truncated'] = false;
                             
                            if (strlen($post['content']) > SELF::OVERVIEW_MAXLEN)
                            {
                               $post['content'] = substr($post['content'], 0, 
                                  SELF::OVERVIEW_MAXLEN);
                               $post['content'] = $post['content'] . ' .....';
                               $post['truncated'] = true;
                            }
                            // AppUtils::logDebug($post);
                            
                            $forums[$i]['mostRecentPost'] = $post;
                         }
             */
         }
         return $forums;
     } catch (PDOException $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:87,代码来源:ForumPostServicePDO.php


示例19: getPDO

<?php

require "header.php";
require "navbar.php";
?>
<div class="container">
	<h1> Name consists of buildings: </h1>

		<?php 
require "./database.php";
$connection = getPDO();
$statement = $connection->prepare("SELECT * FROM buildings");
$statement->execute();
$datarow = array();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
    $datarow[] = $row;
}
//echo "<pre>";
//print_r($datarow);
//echo "</pre>";
?>
<table class="table table-hover">
	
	<tr>
		<th>Name</th>
		<th>Height</th>
		<th>Color</th>
		<th> </th>	
	</tr>
	<?php 
foreach ($datarow as $element) {
开发者ID:noikiy,项目名称:communityblog,代码行数:31,代码来源:list.php


示例20: getRejections

 /**
  * Returns rejected invitations for the specified user
  *
  * @param
  *           string userId
  *           User ID
  * @throws PDOException
  * @return array Array of object contatining all fields from forum_user,
  *         user_account, and forumName, updateFirstName, updateLastName
  */
 public function getRejections($userId)
 {
     $sql = "SELECT forum_user.*,forum.*\n               FROM forum_user, forum\n               WHERE enrollmentStatus = 'R'\n               AND forum_user.userId = :userId\n               AND forum_user.forumId = forum.id";
     try {
         $db = getPDO();
         $stmt = $db->prepare($sql);
         $stmt->bindParam("userId", $userId);
         $stmt->execute();
         $rows = (array) $stmt->fetchAll(PDO::FETCH_NAMED);
         return $this->createEnrollmentObj($rows, false);
     } catch (PDOException $e) {
         throw $e;
     }
 }
开发者ID:szwork2013,项目名称:impulse,代码行数:24,代码来源:ForumServicePDO.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP getPDOConnection函数代码示例发布时间:2022-05-15
下一篇:
PHP getOwnerName函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap