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


PHP dbconnection類代碼示例

本文整理匯總了PHP中dbconnection的典型用法代碼示例。如果您正苦於以下問題:PHP dbconnection類的具體用法?PHP dbconnection怎麽用?PHP dbconnection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了dbconnection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getTweetsPostedBy

 public static function getTweetsPostedBy($idUser)
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.tweet where emetteur='" . $idUser . "'";
     $res = $connection->doQueryObject($sql, "tweet");
     return $res === false ? false : $res;
 }
開發者ID:nikyasu,項目名稱:TweetLkProject,代碼行數:7,代碼來源:tweetTable.class.php

示例2: getPostbyId

 public static function getPostbyId($id)
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.post where id='" . $id . "'";
     $res = $connection->doQueryObject($sql, "post");
     return $res === false ? false : $res;
 }
開發者ID:nikyasu,項目名稱:TweetLkProject,代碼行數:7,代碼來源:postTable.class.php

示例3: save

 public function save()
 {
     $connection = new dbconnection();
     if ($this->id) {
         $sql = "update jabaianb." . get_class($this) . " set ";
         $set = array();
         foreach ($this->data as $att => $value) {
             if ($att != 'id' && $value) {
                 $set[] = "{$att} = '" . $value . "'";
             }
         }
         $sql .= implode(",", $set);
         $sql .= " where id=" . $this->id;
     } else {
         $sql = "insert into jabaianb." . get_class($this) . " ";
         $sql .= "(" . implode(",", array_keys($this->data)) . ") ";
         $sql .= "values ('" . implode("','", array_values($this->data)) . "')";
     }
     $connection->doExec($sql);
     /*
      *  Sans cette modiffication, on recevait une erreur après un UPDATE:
      *      Object not in prerequisite state: 7 ERROR: currval of sequence "post_id_seq" is not yet defined in this session
      */
     if (!$this->id) {
         $this->id = $connection->getLastInsertId("jabaianb." . get_class($this));
     }
     return $this->id == false ? NULL : $this->id;
 }
開發者ID:uy-rrodriguez,項目名稱:twitty,代碼行數:28,代碼來源:basemodel.class.php

示例4: getLike

 public static function getLike($id)
 {
     $connection = new dbconnection();
     $sql = "select count(*) from jabaianb.vote where tweet='" . $id . "'";
     $res = $connection->doQuery($sql);
     return $res === false ? false : $res;
 }
開發者ID:nikyasu,項目名稱:TweetLkProject,代碼行數:7,代碼來源:tweet.class.php

示例5: getUsers

 public static function getUsers()
 {
     $connection = new dbconnection();
     $sql = "select * from jabaianb.utilisateur";
     $res = $connection->doQueryObject($sql, "utilisateurTable");
     return $res === false ? false : $res;
 }
開發者ID:nikyasu,項目名稱:TweetLkProject,代碼行數:7,代碼來源:utilisateurTable.class.php

示例6: getCountLastTweets

 public static function getCountLastTweets($startDate)
 {
     $connection = new dbconnection();
     $sql = "SELECT COUNT(*) FROM jabaianb.tweet T\n\t\t            INNER JOIN jabaianb.post P ON (T.post = P.id)\n\t\t        WHERE P.date > '" . $startDate . "'";
     $res = $connection->doQuery($sql);
     if ($res === false) {
         return null;
     }
     return $res[0]["count"];
 }
開發者ID:uy-rrodriguez,項目名稱:twitty,代碼行數:10,代碼來源:tweetTable.class.php

示例7: getCountLikesById

 public static function getCountLikesById($tweetId)
 {
     $connection = new dbconnection();
     $sql = "SELECT COUNT(*) FROM jabaianb.vote WHERE message = " . $tweetId;
     $res = $connection->doQuery($sql);
     if ($res === false) {
         return 0;
     }
     return $res[0]["count"];
 }
開發者ID:uy-rrodriguez,項目名稱:twitty,代碼行數:10,代碼來源:voteTable.class.php

示例8: getUsersWhoLikeTweetById

 public static function getUsersWhoLikeTweetById($tweetId)
 {
     $connection = new dbconnection();
     $sql = "SELECT U.* FROM jabaianb.utilisateur U\r\n\t\t\t\t\tINNER JOIN jabaianb.vote V ON (U.id = V.utilisateur)\r\n\t\t\t\tWHERE V.message = " . $tweetId;
     $res = $connection->doQueryObject($sql, "utilisateur");
     if ($res === false) {
         return null;
     }
     return $res;
 }
開發者ID:uy-rrodriguez,項目名稱:twitty,代碼行數:10,代碼來源:utilisateurTable.class.php

示例9: preload_lists

function preload_lists()
{
    $db = new dbconnection();
    $db->dbconnect();
    $db->query = "select listid,listname from " . TABLE_LISTS . " where active=1";
    $db->execute();
    $rowcount = $db->rowcount();
    if ($rowcount > 0) {
        for ($x = 0; $x < $rowcount; $x++) {
            $row = $db->fetchrow($x);
            $list[$x] = $row;
        }
    }
    return $list;
}
開發者ID:CallBest,項目名稱:CallCenter-CIMS,代碼行數:15,代碼來源:preloadvalues.php

示例10: getColors

 public static function getColors($pack)
 {
     $sql_colors = dbconnection::queryObject("SELECT * FROM colors WHERE colors_id = '{$pack->colors_id}' LIMIT 1");
     if (!$sql_colors) {
         return new return_package(2, NULL, "The colors you've requested do not exist");
     }
     return new return_package(0, colors::colorsObjectFromSQL($sql_colors));
 }
開發者ID:kimblemj,項目名稱:server,代碼行數:8,代碼來源:colors.php

示例11: getCategoryHints

 public function getCategoryHints($q)
 {
     $query = "select categoryid,name from couponcategories where name LIKE '" . htmlspecialchars($q) . "%'" . " limit 1";
     $dbinstance = dbconnection::getinstance();
     $connhandle = $dbinstance->connhandle;
     $result = $connhandle->query($query);
     return $result;
 }
開發者ID:nitshere,項目名稱:phpfinalTask,代碼行數:8,代碼來源:model_class.php

示例12: getinstance

 public static function getinstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new dbconnection();
     } else {
         //echo "singleton construct not called";
     }
     return self::$instance;
 }
開發者ID:nitshere,項目名稱:phpfinalTask,代碼行數:9,代碼來源:databaseconn.php

示例13: removeEditorFromGame

 public static function removeEditorFromGame($pack)
 {
     $pack->auth->game_id = $pack->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     //note $pack->user_id is DIFFERENT than $pack->auth->user_id
     dbconnection::query("DELETE FROM user_games WHERE user_id = '{$pack->user_id}' AND game_id = '{$pack->game_id}'");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
開發者ID:kimblemj,項目名稱:server,代碼行數:12,代碼來源:editors.php

示例14: changepassword

 function changepassword($userid, $oldpass, $newpass, $newpassrepeat)
 {
     if ($newpass == $newpassrepeat) {
         $enc = new Encryption();
         $db = new dbconnection();
         $db->dbconnect();
         //check oldpass, update password if ok, send message if not
         $password = $enc->oneway_encode($oldpass);
         $db->query = "select userid from " . TABLE_USERS . " where userid={$userid} and password='{$password}'";
         $db->execute();
         if ($db->rowcount() > 0) {
             $newpass = $enc->oneway_encode($newpass);
             $db->query = "update " . TABLE_USERS . " set password='{$newpass}' where userid={$userid}";
             $db->execute();
             $msg = 'Password updated.';
         } else {
             $msg = 'Incorrect old password.';
         }
     } else {
         $msg = 'New password does not match.';
     }
     return $msg;
 }
開發者ID:CallBest,項目名稱:CallCenter-CIMS,代碼行數:23,代碼來源:user.php

示例15: deleteGroup

 public static function deleteGroup($pack)
 {
     $group = dbconnection::queryObject("SELECT * FROM groups WHERE group_id = '{$pack->group_id}'");
     $pack->auth->game_id = $group->game_id;
     $pack->auth->permission = "read_write";
     if (!editors::authenticateGameEditor($pack->auth)) {
         return new return_package(6, NULL, "Failed Authentication");
     }
     dbconnection::query("DELETE FROM groups WHERE group_id = '{$pack->group_id}' LIMIT 1");
     //cleanup
     dbconnection::query("UPDATE game_user_groups SET group_id = 0 WHERE game_id = '{$group->game_id}' AND group_id = '{$group->group_id}';");
     games::bumpGameVersion($pack);
     return new return_package(0);
 }
開發者ID:kimblemj,項目名稱:server,代碼行數:14,代碼來源:groups.php


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