本文整理汇总了PHP中DataBase::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::getById方法的具体用法?PHP DataBase::getById怎么用?PHP DataBase::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::getById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connectDB
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<div class = "row">
<?php
if (isset($_GET["id"])) {
include_once '../php/dedugan.php';
$pd = connectDB();
$id = $_GET["id"];
$table = new DataBase("blog");
$array = $table->getById($pd, $id);
foreach ($array as $item) {
echo "<div class = \"col-md-12 text-center\" ><img src = \"" . $item["imagePath"] . "\" class = \"img-circle\" width=400 height=400><p><h4>{$item["topic"]}</h4></p>\n <p class=\"text-justify\">{$item["mes"]}</p></div>";
}
}
?>
</div>
<div id = "comments">
<div id = "addComment" class = "col-md-12 form-inline">
<div class="form-group"> <input type="text" id = "username" placeholder="Ваше имячкофамилия" value=""></div>
<div class="form-group"> <input type="text" id = "text" placeholder="Ваш комментарий" value=""></div>
<div class="form-group"><button class="btn btn-default" id="comment">Комментировать</button></div>
</div>
示例2: connectDB
<?php
/**
* Created by PhpStorm.
* User: StarWind
* Date: 07.09.2015
* Time: 14:03
*/
include "dedugan.php";
$pd = connectDB();
$bd = new DataBase("blog");
$bd->updateBlogRecord($_POST["id"], $_POST["title"], $_POST["mes"], $pd);
$output = $bd->getById($pd, $_POST["id"]);
foreach ($output as $item) {
echo "<a href='details.php?id={$item["id"]}'><img src = \"" . $item["imagePath"] . "\" class = \"img-circle\" width=200 height=200></a><p><h4>{$item["topic"]}</h4></p>\n <p class=\"text-justify\">{$item["mes"]}</p>\n <button class = \"btn btn-default edit\" value = \"{$item["id"]}\" >Редактировать</button> <br><br>";
}
示例3: json_encode
<?php
/**
* Created by PhpStorm.
* User: StarWind
* Date: 07.09.2015
* Time: 14:03
*/
include "dedugan.php";
$pd = connectDB();
$id = $_POST["id"];
$bd = new DataBase("blog");
$array = $bd->getById($pd, $id);
echo json_encode($array);