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


PHP connection::PDO方法代碼示例

本文整理匯總了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);
}
開發者ID:kevin2ko,項目名稱:humano,代碼行數:15,代碼來源:getProject.php

示例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
}
開發者ID:kevin2ko,項目名稱:humano,代碼行數:16,代碼來源:getCustomer.php


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