本文整理汇总了PHP中dbconnection类的典型用法代码示例。如果您正苦于以下问题:PHP dbconnection类的具体用法?PHP dbconnection怎么用?PHP dbconnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了dbconnection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: save
public function save()
{
$connection = new dbconnection();
if (isset($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)) . "')";
}
//print_r($sql);
$connection->doExec($sql);
$id = $connection->getLastInsertId("jabaianb." . get_class($this));
//print_r($id);
return $id == false ? NULL : $id;
}
开发者ID:nikyasu,项目名称:TweetLkProject,代码行数:24,代码来源:basemodel.class.php
示例17: applyUpgrade
private static function applyUpgrade($user_id, $maj, $min)
{
$file = "db/upgrades/" . $maj . "." . $min . ".sql";
$upgrade = fopen($file, "r");
while (!feof($upgrade)) {
$query = fgets($upgrade);
if (preg_match("@^\\s*\$@is", $query)) {
continue;
}
//ignore whitespace
dbconnection::query($query);
}
fclose($upgrade);
dbconnection::queryInsert("INSERT INTO db_upgrades (user_id, version_major, version_minor, timestamp) VALUES ('{$user_id}', '{$maj}', '{$min}', CURRENT_TIMESTAMP)");
}
开发者ID:kimblemj,项目名称:server,代码行数:15,代码来源:db.php
示例18: deleteOverlay
public static function deleteOverlay($pack)
{
$overlay = dbconnection::queryObject("SELECT * FROM overlays WHERE overlay_id = '{$pack->overlay_id}'");
$pack->auth->game_id = $overlay->game_id;
$pack->auth->permission = "read_write";
if (!editors::authenticateGameEditor($pack->auth)) {
return new return_package(6, NULL, "Failed Authentication");
}
dbconnection::query("DELETE FROM overlays WHERE overlay_id = '{$pack->overlay_id}' LIMIT 1");
//cleanup
$reqPack = dbconnection::queryObject("SELECT * FROM requirement_root_packages WHERE requirement_root_package_id = '{$overlay->requirement_root_package_id}'");
if ($reqPack) {
$pack->requirement_root_package_id = $reqPack->requirement_root_package_id;
requirements::deleteRequirementPackage($pack);
}
games::bumpGameVersion($pack);
return new return_package(0);
}
开发者ID:kimblemj,项目名称:server,代码行数:18,代码来源:overlays.php
示例19: getConnection
public static function getConnection()
{
if (dbconnection::$dbconnection === NULL) {
// database access credentials stored in variables
$host = "localhost";
$database = "n00143888playground";
// $username = "N00143888";
// $password = "N00143888";
$username = "root";
$password = "";
$dsn = "mysql:host=" . $host . ";dbname=" . $database;
dbconnection::$dbconnection = new PDO($dsn, $username, $password);
if (!dbconnection::$dbconnection) {
die("Database connection failed");
}
}
return dbconnection::$dbconnection;
}
开发者ID:aaronoh,项目名称:myFormValidation,代码行数:18,代码来源:dbconnection.php
示例20: getLeaderboard
public static function getLeaderboard($pack)
{
$insts = dbconnection::queryArray("SELECT * FROM instances WHERE game_id = '{$pack->game_id}' AND object_type = 'ITEM' AND object_id = '{$pack->item_id}' AND owner_type = 'USER' ORDER BY qty DESC LIMIT 10;");
$entries = array();
for ($i = 0; $i < count($insts); $i++) {
$inst = $insts[$i];
$user = dbconnection::queryObject("SELECT * FROM users WHERE user_id = '{$inst->owner_id}';");
$entries[$i] = new stdClass();
$entries[$i]->qty = $inst->qty;
if ($user) {
$entries[$i]->user_id = $user->user_id;
$entries[$i]->user_name = $user->user_name;
$entries[$i]->display_name = $user->display_name;
} else {
$entries[$i]->user_id = 0;
$entries[$i]->user_name = "(user not found)";
$entries[$i]->display_name = "(user not found)";
}
}
return new return_package(0, $entries);
}
开发者ID:kimblemj,项目名称:server,代码行数:21,代码来源:misc.php
注:本文中的dbconnection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论