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


PHP Database::close方法代码示例

本文整理汇总了PHP中Database::close方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::close方法的具体用法?PHP Database::close怎么用?PHP Database::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Database的用法示例。


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

示例1: getMainNavigation

 public function getMainNavigation()
 {
     $d = new Database();
     $d->open('hacker_blog');
     $sql = "SELECT * FROM navigation ";
     if ($this->type == 'private') {
         $sql .= " WHERE public = 0 ";
     } else {
         $sql .= " WHERE private = 1 ";
     }
     $s = $d->q($sql);
     if ($s && $d->numrows() >= 1) {
         $arr = array();
         while ($r = $d->mfa()) {
             //print_r($r);
             array_push($arr, $r);
         }
         $this->messages = array("success" => "Found Navigation");
         $this->current = $arr;
         return $arr;
         $d->close();
     } else {
         $this->messages = array("error" => "Could not Find Navigation");
         $d->close();
         return false;
     }
 }
开发者ID:newfront,项目名称:dojophp,代码行数:27,代码来源:clsNavigation.php

示例2: delete

 static function delete($delete)
 {
     $conn = Database::connect();
     $query = "DELETE FROM `linkpreview`.`linkpreview` WHERE `id` = '" . $delete["id"] . "'";
     mysqli_query($conn, $query);
     Database::close($conn);
 }
开发者ID:TonyBytes,项目名称:sharingResearch,代码行数:7,代码来源:Database.php

示例3: delete

	function delete()
	{
		$db = new Database();
		$sql = sprintf("delete from order_props where id = %d", $this->id);
		$db->executeSQL($sql, __FILE__, __LINE__, false);
		$db->close();
	}
开发者ID:njassim,项目名称:SOHO_REPRO,代码行数:7,代码来源:order_prop.class.php

示例4: checkLogin

function checkLogin($login, $pass)
{
    $db = new Database();
    //Traigo el usuario
    $q = "select salt from jugador where login='{$login}' limit 1";
    $r = $db->query($q);
    //Controlo que exista el usuario con el login $login
    if ($db->num_rows($r) > 0) {
        //Traigo el registro
        $data = $db->fetch_array($r);
        $salt_db = $data['salt'];
        //Genero el mismo hash que se creo al registrar jugador
        $hashedpass = hash('sha512', $pass . $salt_db);
        $q2 = "select * from jugador where login='{$login}' and pass=PASSWORD('{$hashedpass}')";
        $r2 = $db->query($q2);
        if ($db->num_rows($r2) > 0) {
            return 1;
        } else {
            return 0;
        }
    } else {
        alertMessage('El usuario no existe');
        exit;
    }
    $db->close();
}
开发者ID:brunitosessa,项目名称:armaelequipo,代码行数:26,代码来源:login.php

示例5: cleanAndPost

 protected function cleanAndPost()
 {
     for ($n = 0; $n < count($this->message_information); $n++) {
         //clean left and white white space, escape the string for the Database
         $this->message_information[$n] = Sanitize::prepForDatabase(Sanitize::clearWhiteSpaceLR($this->message_information[$n]));
     }
     $d = new Database();
     $d->open('hacker_blog');
     //check for duplicates
     $chx = $d->q("SELECT * FROM user_messages WHERE user_messages.message = '{$this->message_information[2]}'");
     if ($chx && $d->numrows() <= 0) {
         // id in the messages field is for the user's uid or user_id, depending on how you are moving forward with your code
         $s = $d->q("INSERT into user_messages\n\t\t\t\t \t\t(user_message_id,first_name,last_name,id,message,type,added_on) VALUES\n\t\t\t\t\t\t(NULL,'{$this->message_information[0]}','{$this->message_information[1]}',NULL,'{$this->message_information[2]}','{$this->type}',now())");
         if ($s) {
             //echo 'made it through gauntlet. Added info into Database.';
             $this->passed = true;
         } else {
             $this->passed = false;
         }
     } else {
         //echo 'You have already made a comment like this.';
         $this->passed = false;
     }
     $d->close();
     //print_r($this->message_information);
 }
开发者ID:newfront,项目名称:dojophp,代码行数:26,代码来源:clsUserBlogCommentMessage.php

示例6: save

 public function save(&$user)
 {
     $bin = array("0", "1");
     $db = new Database();
     $db->query("UPDATE Badge set " . $this->label . "=" . $bin[$this->achieved] . " WHERE id='" . $user->getId() . "'");
     $db->close();
 }
开发者ID:kabartlett,项目名称:spirit-quest,代码行数:7,代码来源:badge.php

示例7: getMainNavigation

 public function getMainNavigation()
 {
     $d = new Database();
     $d->open('hacker_blog');
     $s = $d->q("SELECT * FROM navigation");
     if ($s) {
         $r = $d->mfa();
         $this->messages = array("success" => "Found Navigation");
         $d->close();
         return $r;
     } else {
         $this->messages = array("error" => "Could not Find Navigation");
         $d->close();
         return false;
     }
 }
开发者ID:newfront,项目名称:dojophp,代码行数:16,代码来源:clsNavigation.php

示例8: Database

 function __construct()
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/restfulController/application/database.php';
     $database = new Database();
     $query = "SELECT * FROM Menu LEFT JOIN Content ON Menu.MenuContentKey = Content.ContentKey ORDER BY Menu.MenuID ASC";
     $this->Menu = $database->execute($query);
     $database->close();
 }
开发者ID:adu89,项目名称:RestFramework,代码行数:8,代码来源:menu.php

示例9: delete

 static function delete($delete)
 {
     $conn = Database::connect();
     $delete = array_map("mysql_real_escape_string", $delete);
     $query = "DELETE FROM `linkpreview`.`linkpreview` WHERE `id` = '" . $delete["id"] . "'";
     mysql_query($query);
     Database::close($conn);
 }
开发者ID:gabrieljo,项目名称:Facebook-Link-Preview,代码行数:8,代码来源:Database.php

示例10: insert

 static function insert($save)
 {
     $conn = Database::connect();
     $save = array_map("mysql_real_escape_string", $save);
     $query = "INSERT INTO `linkpreview`.`linkpreview` (`id`, `text`, `image`, `title`, `canonicalUrl`, `url`, `description`, `iframe`)\n                        VALUES (NULL, '" . $save["text"] . "', '" . $save["image"] . "', '" . $save["title"] . "', '" . $save["canonicalUrl"] . "', '" . $save["url"] . "', '" . $save["description"] . "', '" . $save["iframe"] . "')";
     mysql_query($query);
     Database::close($conn);
 }
开发者ID:jclyons52,项目名称:mycourse-rocks,代码行数:8,代码来源:Database.php

示例11: count

 public static function count()
 {
     $db = new Database();
     $sql = "SELECT COUNT(distinct session_group) FROM panelmembers";
     $result = $db->query($sql);
     $row = $db->fetch($result);
     $db->close();
     return intval($row['COUNT(distinct session_group)']);
 }
开发者ID:sabbirrahman,项目名称:uuictclub,代码行数:9,代码来源:PanelMember.php

示例12: getEventById

 public function getEventById($id)
 {
     $sql = "select * from event where id='{$id}'";
     $db = new Database();
     $db->connect();
     $eventInfo = $db->query_first($sql);
     $db->close();
     return $eventInfo;
 }
开发者ID:rapude,项目名称:dhamma-reise,代码行数:9,代码来源:Event.class.php

示例13: showCloumns

function showCloumns($db, $table)
{
    $d = new Database();
    $d->setDB('hacker_blog');
    $cols = $d->showTableColumns($table);
    $d->close();
    print_r($cols);
    return $cols;
}
开发者ID:newfront,项目名称:dojophp,代码行数:9,代码来源:application_helper.php

示例14: count

 public static function count()
 {
     $db = new Database();
     $sql = "SELECT COUNT(UID) FROM userids";
     $result = $db->query($sql);
     $row = $db->fetch($result);
     $db->close();
     return intval($row['COUNT(UID)']) - 1;
 }
开发者ID:sabbirrahman,项目名称:uuictclub,代码行数:9,代码来源:Member.php

示例15: getNameById

 public function getNameById($id)
 {
     $sql = "select name from centre where id='{$id}'";
     $db = new Database();
     $db->connect();
     $name = $db->query_first($sql);
     $db->close();
     return $name['name'];
 }
开发者ID:rapude,项目名称:dhamma-reise,代码行数:9,代码来源:Centre.class.php


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