本文整理汇总了PHP中close_database函数的典型用法代码示例。如果您正苦于以下问题:PHP close_database函数的具体用法?PHP close_database怎么用?PHP close_database使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了close_database函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: erro
function erro($msg, $id_conn)
{
echo $msg;
execute_query("END TRANSACTION", $id_conn);
execute_query("ROLLBACK", $id_conn);
close_database($id_conn);
return;
}
示例2: print_footer
function print_footer($msg = "")
{
if ($msg != "") {
print "<hr/>\n";
print "{$msg}\n";
}
print "<hr/>\n";
print "<div style='float: left'><a href='http://pecanproject.org'>PEcAn Project</a></div>\n";
print "<div style='float: right'><a href='http://betydb.org'>BETY Project</a></div>\n";
print "</body>\n";
print "</html>\n";
close_database();
}
示例3: grava_usuario
function grava_usuario()
{
$filename = upload_foto();
require '../config/infodbcon.php';
require '../config/database.php';
$id_conn = open_database();
$post = array_map("mysql_real_escape_string", $_POST);
execute_query("START TRANSACTION", $id_conn);
if ($post['cmb_cadastro'] == '0') {
$sql = 'INSERT INTO tb_usuario ';
$sql .= '(usuario_nome, usuario_login, usuario_senha, usuario_email, usuario_foto, usuario_info, usuario_ativo)';
$sql .= 'VALUES ';
$sql .= '(\'' . addslashes(utf8_decode($_POST['nome'])) . '\', \'' . utf8_decode($post['login']) . '\', ';
$sql .= '\'' . md5('123mudar') . '\', \'' . $post['email'] . '\',';
$sql .= '\'' . $filename . '\', \'' . addslashes(utf8_decode($_POST['infor'])) . '\', \'' . ($post['ativo'] ? 1 : 0) . '\')';
} else {
$sql = 'UPDATE tb_usuario SET ';
$sql .= 'usuario_nome = \'' . addslashes(utf8_decode($_POST['nome'])) . '\', usuario_login = \'' . $post['login'] . '\', ';
$sql .= 'usuario_email = \'' . $post['email'] . '\', ';
$sql .= 'usuario_info=\'' . addslashes(utf8_decode($_POST['infor'])) . '\', ';
$sql .= 'usuario_ativo=\'' . (isset($post['ativo']) ? 1 : 0) . '\' ';
if ($post['trocoufoto']) {
$sql .= ',usuario_foto=\'' . $filename . '\' ';
}
$sql .= 'WHERE ';
$sql .= 'usuario_id=' . $post['cmb_cadastro'];
}
if (!execute_query($sql, $id_conn)) {
$messagem = utf8_decode('Query Inválida: ') . mysql_error() . "\n";
$messagem .= 'Pesquisa Inteira: ' . $sql;
echo $messagem;
execute_query("ROLLBACK", $id_conn);
} else {
execute_query('COMMIT', $id_conn);
echo '1';
}
execute_query("END TRANSACTION", $id_conn);
close_database($id_conn);
}
示例4: open_database
*/
// Check login
require "common.php";
if ($authentication) {
open_database();
if (!check_login()) {
header("Location: index.php");
close_database();
exit;
}
if (get_page_acccess_level() > $min_run_level) {
header("Location: history.php");
close_database();
exit;
}
close_database();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>EBI Sites</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="sites.css" />
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
function validate() {
$("#error").html("");
}
示例5: session_start
<?php
/*
@Autor: Clésio Teixeira da Silva
@Versão: 2.2
@Última Alteração: 14/09/2015
*/
session_start();
// arquivo de funções.
require "../funcoes/php/funcao.php";
//Função encontrada dentro do arquivo funcao.php. Tem como incumbência verificar se o usuário está logado.
session_checker();
require "../config/infodbcon.php";
require "../config/database.php";
$id_conn = open_database();
libera_acesso('colecao', $id_conn);
close_database($id_conn);
require '../html/colecao.html';
echo '<script>foto_usuario(\'' . $_SESSION['usuario_id'] . '\')</script>';
exit;
示例6: DeleteFileFromDatabase
function DeleteFileFromDatabase($md5)
{
if (!open_database()) {
return array();
}
$results = exec_query("DELETE FROM storage WHERE md5 = '" . escape_string($md5, false) . "'", false);
close_database();
return $results;
}
示例7: cleanSearchTables
function cleanSearchTables()
{
// Clean up the database tables before performing a new search or updating the collection
debuglog("Cleaning Search Results", "MYSQL", 6);
// Any track that was previously hidden needs to be re-hidden
generic_sql_query("UPDATE Tracktable SET Hidden = 1, isSearchResult = 0 WHERE isSearchResult = 3");
// Any track that was previously a '2' (added to database as search result) but now
// has a playcount needs to become a zero and be hidden.
hide_played_tracks();
// remove any remaining '2's
generic_sql_query("DELETE FROM Tracktable WHERE isSearchResult = 2");
// Set '1's back to '0's
generic_sql_query("UPDATE Tracktable SET isSearchResult = 0 WHERE isSearchResult = 1");
// This may leave some orphaned albums and artists
remove_cruft();
//
// remove_cruft creates some temporary tables and we need to remove them because
// remove cruft will be called again later on if we're doing a collection update.
// Sadly, DROP TABLE runs into locking problems, at least with SQLite, so instead
// we close the DB connection and start again.
// So this function must be called BEFORE prepareCollectionUpdate, as that creates
// temporary tables of its own.
//
close_database();
sleep(1);
connect_to_database();
}
示例8: erro
function erro($msg, $id_conn)
{
echo json_encode(array('id' => '-1', 'msg' => $msg));
execute_query("END TRANSACTION", $id_conn);
execute_query("ROLLBACK", $id_conn);
close_database($id_conn);
return;
}