当前位置: 首页>>代码示例>>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;未经允许,请勿转载。