本文整理汇总了PHP中closedb函数的典型用法代码示例。如果您正苦于以下问题:PHP closedb函数的具体用法?PHP closedb怎么用?PHP closedb使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了closedb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: method_deneme
function method_deneme()
{
if (isset($_REQUEST['next']) || isset($_REQUEST['summary']) || isset($_REQUEST['viewsummary'])) {
//next question
$answerStatus = 'unanswered';
if (time() < strtotime($_SESSION['endtime'])) {
if (strcmp($answerStatus, "unanswered") != 0) {
if (strcmp($answerStatus, "answered") == 0) {
$query = "update studentquestion set answered='answered',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
} else {
$query = "update studentquestion set answered='review',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
}
if (!executeQuery($query)) {
// to do
$_GLOBALS['message'] = "Your previous answer is not updated.Please answer once again";
}
closedb();
}
}
if ((int) $_SESSION['qn'] < (int) $_SESSION['tqn']) {
$_SESSION['qn'] = $_SESSION['qn'] + 1;
}
if ((int) $_SESSION['qn'] == (int) $_SESSION['tqn']) {
$endOfTest = true;
}
} else {
if (isset($_REQUEST['previous'])) {
// Perform the changes for current question
$answerStatus = 'unanswered';
if (time() < strtotime($_SESSION['endtime'])) {
$questionStatus = $this->getQuestionStatus();
if (strcmp($answerStatus, "unanswered") != 0) {
if (strcmp($answerStatus, "answered") == 0) {
$query = "update studentquestion set answered='answered',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
} else {
$query = "update studentquestion set answered='review',stdanswer='" . htmlspecialchars($_REQUEST['answer'], ENT_QUOTES) . "' where stdid=" . $_SESSION['stdid'] . " and testid=" . $_SESSION['testid'] . " and qnid=" . $_SESSION['qn'] . ";";
}
if (!executeQuery($query)) {
// to do
$_GLOBALS['message'] = "Your previous answer is not updated.Please answer once again";
}
closedb();
}
}
//previous question
if ((int) $_SESSION['qn'] > 1) {
$_SESSION['qn'] = $_SESSION['qn'] - 1;
}
} else {
if (isset($_REQUEST['fs'])) {
//Final Submission
header('Location: testack.php');
}
}
}
}
示例2: delSujetAtelier
function delSujetAtelier($id)
{
$sql = "DELETE FROM `tab_atelier_sujet` WHERE `id_sujet`='" . $id . "'\n\t";
$db = opendb();
$result = mysqli_query($db, $sql);
closedb($db);
if (FALSE == $result) {
return FALSE;
} else {
return TRUE;
}
}
示例3: conn_db
function conn_db($hostname, $username, $password, $database)
{
$link = mysql_connect($hostname, $username, $password);
if (!$link) {
//echo "Mysql Connect Error".mysql_error();
return false;
}
$ret = mysql_select_db($database);
if (!$ret) {
closedb($link);
return false;
}
set_encode($link);
return $link;
}
示例4: createXls
function createXls()
{
$page = getQUERY("page");
$from = getQUERY("from");
$page1 = $page;
$req = getQUERY("req");
$req1 = str_replace("**", "&", $req);
$url = "";
$temp = explode("&", $req1);
$cid = getQUERY("c");
$uid = getQUERY("u");
$sd = substr($temp[1], 3);
$ed = substr($temp[2], 3);
$lang = substr($temp[0], 2);
opendb();
/* format na datum */
$datetimeformat = dlookup("select datetimeformat from users where id=" . $uid);
//'Y-m-d h:i:s a'; //
$datfor = explode(" ", $datetimeformat);
$dateformat = $datfor[0];
$timeformat = $datfor[1];
if ($timeformat == "H:i:s") {
$e_ = " 23:59";
$e1_ = "_23:59";
$s_ = " 00:00";
$s1_ = "_00:00";
$tf = " H:i";
} else {
$e_ = " 11:59 PM";
$e1_ = "_11:59_PM";
$s_ = " 12:00 AM";
$s1_ = "_12:00_AM";
$tf = " h:i a";
}
$sdG = DateTimeFormat($sd, 'd-m-Y H:i:s');
$edG = DateTimeFormat($ed, 'd-m-Y H:i:s');
/* format na datum */
$nameXls = $page1 . '_' . $cid . '_' . DateTimeFormat($sdG, $dateformat) . $s1_ . '_' . DateTimeFormat($edG, $dateformat) . $e1_ . '.xls';
$url = $page . "1.php?l=" . $lang . "&u=" . $uid . "&c=" . $cid . "&sd=" . DateTimeFormat($sd, "d-m-Y") . "%2000:00:00&ed=" . DateTimeFormat($ed, "d-m-Y") . "%2023:59:00&from=s";
closedb();
if ($from == "s") {
$handle = fopen('../savePDF/' . $nameXls, 'w+') or die('Cannot open file: ' . $nameXls);
$data = file_get_contents("http://panorama.gps.mk/settings/" . $url);
fwrite($handle, $data);
fclose($handle);
echo $nameXls;
}
}
示例5: dic_
?>
<span class="text2" style="font-style:italic; color:#153B75; font-size:12px"><?php
echo dic_("Reports.NoDataDay");
?>
</span></strong></td>
</tr>
<?php
}
?>
</table>
<?php
$_datumCnt = addToDate($_datumCnt, 1, "days");
}
closedb();
?>
<br /><br />
</div><br>
<div id="footer-rights-new" class="textFooter" style="padding:10px 10px 10px 10px">
<?php
echo $CopyrightString;
?>
| <?php
echo session("company");
?>
| <?php
echo session("user_fullname");
?>
| <?php
echo $CreationDate;
示例6: while
</tr>
<?php
while ($row = mysql_fetch_array($ret)) {
$i = $i + 1;
if ($row['type'] == 1) {
$type = "judgement";
} elseif ($row['type'] == 2) {
$type = "fill";
} else {
$type = "choice";
}
$query1 = "SELECT * FROM " . $type . "_" . $row['chapter'] . " WHERE " . $type . "_no=" . $row['no'];
$ret1 = mysql_query($query1, $link);
if (!$ret1) {
echo "query ERROR";
closedb($link);
exit;
}
$row1 = mysql_fetch_row($ret1);
?>
<tr>
<td align="center">
<?php
echo $row1[1];
?>
</td>
<td align="center" width="600px">
<?php
echo $row1[2];
示例7: set_time_limit
#!/usr/bin/php -q
<?php
////////////////////////////////////////////////////////////////////////////
// $Id$
//
// Description: statistics cleanup
//
////////////////////////////////////////////////////////////////////////////
include "cleanup-functions.php";
include "cleanup-config.php";
// ************* PRELIMINARY TASKS, DATA INIT *************
set_time_limit(0);
// get for which revision we generate stats
if ($argv[1] == "") {
$rev = "HEAD";
} else {
$rev = $argv[1];
}
// open database connection
$dbh = initdb($sql_host, $sql_user, $sql_pass, $sql_db);
debug(10, "cleanup statistics");
$res = @mysql_query("DELETE FROM essential WHERE rev='{$rev}' AND " . "sdate < DATE_SUB(NOW(),INTERVAL '60' DAY)", $dbh);
if (!$res) {
send_err("SQL error: delete by sdate for {$rev} branch.");
die;
}
$deleted = @mysql_affected_rows($dbh);
debug(10, "deleted {$deleted} records for {$rev} branch");
closedb($dbh);
// send_ok("Deleted $deleted records for $rev branch.");
示例8: redirect
public static function redirect($url, $cnd = true)
{
if ($cnd) {
closedb();
header("Location: " . $url);
exit(0);
}
}
示例9: closedb
if(radios[i].checked === true) {
return radios[i].value;
}
}
}
$(document).ready(function(){
$('.del-btn').button({ icons: { primary: "ui-icon-trash"} });
$('.edit-btn').button({ icons: { primary: "ui-icon-pencil"} });
$('#add5').button({ icons: { primary: "ui-icon-plusthick"} });
$('#play').button({ icons: { primary: "ui-icon-play"} });
$('#pause').button({ icons: { primary: "ui-icon-pause"} });
$('#poglasno').button({ icons: { primary: "ui-icon-plus"} });
$('#potivko').button({ icons: { primary: "ui-icon-minus"} });
$('#gfAvail').buttonset();
$('#main_table tr td:nth-child(3) div').hide();
setDates();
top.HideWait();
});
</script>
</html>
<?php closedb(); ?>
示例10: enterConnexionstatus
function enterConnexionstatus($iduser, $date, $type, $macadress, $navig, $exploitation)
{
$sql = "INSERT INTO `tab_connexion`(`id_connexion`, `id_user`, `date_cx`, `type_cx`, `macasdress_cx`, `navigateur_cx`, `system_cx`) \n\tVALUES ('','" . $iduser . "','" . $date . "','" . $type . "','" . $macadress . "','" . $navig . "','" . $exploitation . "')";
$db = opendb();
$result = mysqli_query($db, $sql);
closedb($db);
if ($result == TRUE) {
return TRUE;
} else {
return FALSE;
}
}
示例11: eachResult
function eachResult($iID)
{
//显示基本信息信息
echo '<font style="color:red;font-weight:bold;">一:基本信息:</font><br/><br/>';
$query = "select formid from Basic" . $iID . " where formid=1;";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
if (mysql_fetch_row($result)) {
//显示信息
$question1 = array('姓名', '年龄(周岁)', '性别', '受教育程度', '年级', '民族', '宿舍号', '电话', '身高(cm)', '体重(kg)', 'Email', '身份证号', '个人编号', '出生地', '大学前长居住地', '睡眠时间是否规律', '每日平均睡眠时间(小时)', '每日平均睡眠时间(分钟)', '是否有午休习惯', '一周几次', '一次多长时间', '过去一年是否从事倒班工作', '几次', '过去三个月是否进行跨越1个时区以上的旅行', '如有,请注明时间地点', '有无睡眠相关疾病', '如有,请说疾病名称和患病时间', '平均每周饮酒', '平均每周饮咖啡', '您的月经周期是否规律', '您的月经周期', '平均每次月经持续时间', '初潮年龄');
for ($i = 1; $i <= 33; $i++) {
$query = "select * from Basic" . $iID . " where formid=1 and questionid=" . $i . ";";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
while ($r = mysql_fetch_row($result)) {
if ($r[3] == '') {
$r[3] = '此处没有填写';
}
echo '<font style="color:#0000FF">' . $question1[$i - 1] . '</font>:' . $r[3] . '<br/>';
}
}
//BMI指数计算
echo '<font style="color:#0000FF;font-weight:bold;">BMI指数:</font>';
$query = "call BMI('Basic" . $iID . "',@output);";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
$r = mysql_fetch_row($result);
echo $r[0];
mysql_free_result($result);
}
closedb();
//显示表二的信息
echo '<br/><br/><font style="color:red;font-weight:bold;">二:睡眠研究问卷调查:</font>';
echo '<br/><br/><font style="color:#E99324;font-weight:bold;">表二:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
$query = "select formid from PartTwo" . $iID . " where formid=2;";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
if (mysql_fetch_row($result)) {
//显示信息
$question2 = array('1.', '2.', '3.', '4.', '5(1).', '5(2).', '5(3).', '5(4).', '5(5).', '5(6).', '5(7).', '5(8).', '5(9).', '5(10).', '5(10)', '6.', '7', '8', '9', '10', '10(1).', '10(2).', '10(3).', '10(4).', '10(5).', '10(5)');
for ($i = 1; $i <= 26; $i++) {
$query = "select * from PartTwo" . $iID . " where formid=2 and questionid=" . $i . ";";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
while ($r = mysql_fetch_row($result)) {
if ($r[3] == '') {
$r[3] = '此处没有填写';
}
echo '<font style="color:#0000FF">' . $question2[$i - 1] . '</font> ' . $r[3] . '  ';
}
}
//显示表二计算结果
echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
$query = "call score2('PartTwo" . $iID . "',@A,@B,@c,@D,@E,@F,@G,@score);";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
while ($r = mysql_fetch_row($result)) {
echo '<font style="color:#0000FF">睡眠质量(A):</font>' . $r[0] . '     <font style="color:#0000FF">入睡时间(B):</font>' . $r[1] . '     <font style="color:#0000FF">睡眠时间(C):</font>' . $r[2] . '     <font style="color:#0000FF">睡眠效率(D):</font>' . $r[3] . '     <font style="color:#0000FF">睡眠障碍(E):</font>' . $r[4] . '     <font style="color:#0000FF">催眠药物(F):</font>' . $r[5] . '     <font style="color:#0000FF">日间功能障碍(G):</font>' . $r[6] . '     <font style="color:#0000FF">PSQI总分:</font>' . $r[7] . '<br/><br/>';
}
mysql_free_result($result);
}
closedb();
//显示表三的信息
echo '<font style="color:#E99324;font-weight:bold;">表三:</font><br/>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br/>';
$query = "select formid from PartTwo" . $iID . " where formid=3;";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
if (mysql_fetch_row($result)) {
//显示信息
$question3 = array('1.', '2.', '3.', '4.', '5.', '6.', '7.', '8');
for ($i = 1; $i <= 8; $i++) {
$query = "select * from PartTwo" . $iID . " where formid=3 and questionid=" . $i . ";";
$result = executeQuery($query);
if (!$result) {
die(mysql_error());
}
while ($r = mysql_fetch_row($result)) {
if ($r[3] == '') {
$r[3] = '此处没有填写';
}
echo '<font style="color:#0000FF">' . $question3[$i - 1] . '</font> ' . $r[3] . '  ';
}
}
//显示表三计算结果
echo '<br/><br/><font style="color:#0000FF;font-weight:bold;">结论:</font><br/><br/>';
$query = "call score('PartTwo" . $iID . "',3,@score);";
//.........这里部分代码省略.........
示例12: getResaBy2dates
function getResaBy2dates($id, $date1, $date2)
{
$sql = "SELECT `id_resa`,`dateresa_resa`,`debut_resa`,`duree_resa`,nom_computer FROM tab_resa \n INNER JOIN tab_computer ON id_computer=id_computer_resa\n WHERE `id_user_resa`=" . $id . " \n\t\tAND `dateresa_resa` BETWEEN '" . $date1 . "' AND '" . $date2 . "'\n\t\tORDER BY `dateresa_resa` DESC , `debut_resa` DESC";
$db = opendb();
$result = mysqli_query($db, $sql);
closedb($db);
if (FALSE == mysqli_num_rows($result)) {
return FALSE;
} else {
return $result;
}
}
示例13: insertCapt
function insertCapt()
{
$sql = "INSERT INTO `tab_captcha`(`id_captcha`, `capt_activation`, `capt_code`) VALUES (1,'N','') ;";
$db = opendb();
$result = mysqli_query($db, $sql);
closedb($db);
if (FALSE == $result) {
$row = "echec";
} else {
$row = "OK";
}
return $row;
}
示例14: array
$sql = "INSERT INTO " . $table;
$fields = array();
$values = array();
foreach ($_GET as $key => $val) {
$column = $key;
echo "<br>{$key} = {$val}<br>";
$fields[] = "`{$key}`";
$values[] = "'" . $val . "'";
$mysqli = connectdb($dbhost, $dbuser, $dbpassword, $db);
// connect to database
createdbcol($mysqli, $column, $table);
// create columns
}
senddbdata($sql, $mysqli, $fields, $values);
// send data
closedb($mysqli);
// close database
// connect to database
function connectdb($dbhost, $dbuser, $dbpassword, $db)
{
$mysqli = new mysqli("{$dbhost}", "{$dbuser}", "{$dbpassword}", "{$db}");
/* check connection */
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit;
}
return $mysqli;
}
// create column
function createdbcol($mysqli, $column, $table)
{
示例15: getCyberSpec
function getCyberSpec($epn)
{
$sql = "SELECT * FROM `tab_espace` WHERE `id_espace`='" . $epn . "' ";
$db = opendb();
$result = mysqli_query($db, $sql);
closedb($db);
if (FALSE == $result) {
return FALSE;
} else {
return mysqli_fetch_array($result);
}
}