本文整理汇总了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;
}
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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;
}
}
示例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();
}
示例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);
}
示例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);
}
示例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)']);
}
示例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;
}
示例13: showCloumns
function showCloumns($db, $table)
{
$d = new Database();
$d->setDB('hacker_blog');
$cols = $d->showTableColumns($table);
$d->close();
print_r($cols);
return $cols;
}
示例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;
}
示例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'];
}