本文整理汇总了PHP中connection::PDO方法的典型用法代码示例。如果您正苦于以下问题:PHP connection::PDO方法的具体用法?PHP connection::PDO怎么用?PHP connection::PDO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connection
的用法示例。
在下文中一共展示了connection::PDO方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connection
<?php
include "../../class/connect.class.php";
$connect = new connection();
$db = $connect->PDO();
//$list = Array();
$query = $db->query("SELECT *FROM project WHERE p_status = '1'");
if (isset($_POST["projId"])) {
$p_id = $_POST["projId"];
$query = $db->query("SELECT *FROM project JOIN customer USING (p_id) WHERE p_id = '{$p_id}'");
foreach ($query as $row) {
$list = array("projId" => strtoupper($row["p_id"]), "projName" => strtoupper($row["p_name"]), "location" => strtoupper($row["p_location"]), "period" => $row["p_timeperiod"], "price" => $row["p_contractprice"], "customer" => $row["c_name"]);
}
echo json_encode($list);
}
示例2: connection
<?php
include "../../class/connect.class.php";
$connection = new connection();
$db = $connection->PDO();
$customer = array();
//$queryname = $db->query(""); // insert query insice ("")
// $query = $db->query("SELECT * FROM applicants JOIN civil_status USING(civId)");
$query = $db->query("SELECT * FROM applicants");
if ($query->rowcount() > 0) {
foreach ($query as $row) {
$customer[] = array("name" => $row["appName"], "address" => $row["address"], "contact" => $row["contact"], "dob" => $row["dob"], "civilstat" => $row["civilstatus"]);
}
echo json_encode($customer);
//print $items as json format // ()inside this is the array name of the querry
}