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


PHP connection类代码示例

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


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

示例1: RemoveAuction

function RemoveAuction($config, $jsonResult)
{
    $id = $_GET['auction_id'];
    $conn = new connection($config);
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
    $conn->query("DELETE FROM allegro where auction_id='" . $id . "';");
}
开发者ID:dakusinio,项目名称:Sale,代码行数:7,代码来源:removeAuction.php

示例2: AddProduct

function AddProduct($config, $jsonResult)
{
    $cargo_id = $_GET["cargo_id"];
    $kind_id = "";
    $kind = $_GET["kind"];
    $amount = $_GET["amount"];
    $sql1 = "SELECT COUNT(name) as kind_amount , kind_id FROM kind WHERE name = '" . $kind . "';";
    $sql2 = "INSERT INTO kind(name) VALUES('" . $kind . "')";
    $conn = new connection($config);
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
    try {
        $result1 = $conn->query($sql1);
        foreach ($result1 as $row) {
            if ($row['kind_amount'] === "0") {
                $conn->query($sql2);
                $kind_id = $conn->conn->lastInsertId();
            } else {
                $kind_id = $row['kind_id'];
            }
        }
        $conn->query("INSERT INTO product(cargo_id , amount , kind_id) VALUES(" . $cargo_id . " , " . $amount . " , " . $kind_id . ")");
        $product_id = $conn->conn->lastInsertId();
        $jsonResult->json_data['result_data'] = $product_id;
    } catch (PDOException $e) {
        $jsonResult->json_data['result_code'] = JSON::$resultCodes['mysql_exception'];
    }
}
开发者ID:dakusinio,项目名称:Sale,代码行数:27,代码来源:addProduct.php

示例3: fetchOne

 public static function fetchOne($sql)
 {
     $con = new connection();
     $con->execute($sql);
     $con->fetch();
     return $con->rows;
 }
开发者ID:pearlsortman,项目名称:ipohype,代码行数:7,代码来源:connection.php

示例4: the_cat

 function the_cat($by_name = null, $linked = null)
 {
     if ($this->is_object()) {
         if (!empty($this->cat)) {
             // Gibt die ID der Kategorie zurück
             if (null == $by_name) {
                 return $this->cat;
                 // Gibt den Titel der Kategorie zurück
             } else {
                 $db = new connection();
                 $get_the_catname = $db->query('SELECT * FROM object WHERE id=' . $this->cat);
                 $the_catname = $db->fetch_array();
                 if (null !== $linked) {
                     // Kategorie wird als Link ausgegeben
                     return '<a href="./?cat=' . $the_catname['id'] . '" rel="nofollow">' . $the_catname['title'] . '</a> ';
                 } else {
                     // Kategorie wird nicht als Link ausgegeben
                     return $the_catname['title'] . " ";
                 }
             }
         } else {
             return false;
         }
     }
 }
开发者ID:zarat,项目名称:Simplepress,代码行数:25,代码来源:class_object.php

示例5: has_items

    function has_items($id)
    {
        $db = new connection();
        $db->query('SELECT * FROM object WHERE type="page" AND status=1 AND parent_id=' . $id);
        if ($this->has_child($id)) {
            ?>
<ul class="submenu">
<?php 
        }
        while ($result = $db->fetch_array()) {
            ?>
<li><a href='./?page_id=<?php 
            echo $result['id'];
            ?>
'><?php 
            echo $result['menu_title'];
            ?>
</a>
<?php 
            if ($this->has_items($result['id'])) {
                echo $this->has_items($result['id']);
            }
            ?>
</li>
<?php 
        }
        if ($this->has_child($id)) {
            ?>
</ul>
<?php 
        }
    }
开发者ID:zarat,项目名称:Simplepress,代码行数:32,代码来源:class_navigation.php

示例6: getRowCount

 public static function getRowCount()
 {
     $con = new connection();
     $connection = $con->getConnection();
     $query = "select * from manufacturer";
     $result = $connection->query($query) or die(mysqli_error($connection));
     return mysqli_num_rows($result) + 10;
 }
开发者ID:botocorpers,项目名称:randomSerialsGenerator,代码行数:8,代码来源:manufacturer.php

示例7: dateExists

function dateExists()
{
    $date = date('Y-m-d', strtotime($_GET['date']));
    $sql = "SELECT COUNT(*) AS count FROM ipodate WHERE ipodate = '" . mysql_escape_string($date) . "'";
    $con = new connection();
    $con->execute($sql);
    die($con->fetch());
}
开发者ID:pearlsortman,项目名称:ipohype,代码行数:8,代码来源:control.php

示例8: uploadFile

 public function uploadFile($uploadclassObj)
 {
     $fileid = $uploadclassObj->getFileid();
     $upload_filename = $uploadclassObj->getFilename();
     $con = new connection();
     $connection = $con->getConnection();
     $query = "insert into uploads values(null, '{$fileid}', '{$upload_filename}')";
     $result = $connection->query($query) or die(mysqli_error($connection));
 }
开发者ID:botocorpers,项目名称:SmartDocApp,代码行数:9,代码来源:uploadDAO.php

示例9: getUserByName

 public function getUserByName($name)
 {
     $con = new connection();
     $db = $con->getConnection();
     $sql = "SELECT * FROM user WHERE name=" . $name;
     foreach ($db->query($sql) as $row) {
         $user[] = array('id' => $row['id'], 'name' => $row['name'], 'password' => $row['password'], 'mail' => $row['mail'], 'adresse' => $row['adresse'], 'tel' => $row['tel']);
     }
 }
开发者ID:Code2Consumer,项目名称:bibliotheque,代码行数:9,代码来源:user.php

示例10: GetAuctionList

function GetAuctionList($config, $jsonResult)
{
    $conn = new connection($config);
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
    $result = $conn->query("SELECT auction_id , name , sandbox FROM allegro;");
    foreach ($result as $row) {
        array_push($jsonResult->json_data['result_data'], array('id' => $row['auction_id'], 'name' => $row['name'], 'sandbox' => $row['sandbox']));
    }
}
开发者ID:dakusinio,项目名称:Sale,代码行数:9,代码来源:getAuctionList.php

示例11: GetCargoName

function GetCargoName($config, $jsonResult)
{
    $cargo_id = $_GET['cargo_id'];
    $conn = new connection($config);
    $result = $conn->query("SELECT name FROM cargo WHERE cargo_id = " . $cargo_id . ";");
    foreach ($result as $row) {
        array_push($jsonResult->json_data["result_data"], $row['name']);
    }
    $jsonResult->json_data["result_code"] = JSON::$resultCodes['ok'];
}
开发者ID:dakusinio,项目名称:Sale,代码行数:10,代码来源:getCargoName.php

示例12: AddCargo

function AddCargo($config, $jsonResult)
{
    $name = $_GET['name'];
    $conn = new connection($config);
    $jsonResult->json_data['result_code'] = JSON::$resultCodes['ok'];
    try {
        $conn->query("INSERT INTO cargo(name) VALUES('" . $name . "');");
    } catch (PDOException $e) {
        $jsonResult->json_data['result_code'] = JSON::$resultCodes['mysql_exception'];
    }
}
开发者ID:dakusinio,项目名称:Sale,代码行数:11,代码来源:addCargo.php

示例13: useralive

 function useralive($userid)
 {
     $con= new connection();
     $con->execute("select time from users where iduser='$userid'");
     $con->fetch();
     $time1=  $con->rows['time'];
     if ($time1<(time()-13))
     return false;
     else
     return true;
 }
开发者ID:slavik0329,项目名称:mobileroulette,代码行数:11,代码来源:users.class.php

示例14: getSymbols

function getSymbols()
{
    // get the full list of IPOs in the database
    $sql = "SELECT DISTINCT symbol FROM ipo";
    $con = new connection();
    $con->execute($sql);
    $symbols = array();
    while ($con->fetch()) {
        $symbols[] = $con->rows["symbol"];
    }
    return $symbols;
}
开发者ID:pearlsortman,项目名称:ipohype,代码行数:12,代码来源:iposcrape.php

示例15: getCargoListWithKinds

function getCargoListWithKinds($config, $jsonResult)
{
    $conn = new connection(new Config(null, null));
    $result = array();
    $cargoes = $conn->query("SELECT * FROM cargo");
    foreach ($cargoes as $cargo) {
        $kinds = $conn->query("SELECT DISTINCT kind.name\n                FROM product INNER JOIN kind on product.kind_id = kind.kind_id\n                WHERE cargo_id =" . $cargo['cargo_id']);
        $kinds = $kinds->fetchAll();
        array_push($result, array('name' => $cargo['name'], 'kinds' => $kinds));
    }
    $jsonResult->json_data['result_data'] = $result;
}
开发者ID:dakusinio,项目名称:Sale,代码行数:12,代码来源:getCargoListWithKinds.php


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