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


PHP db_fatal_error函数代码示例

本文整理汇总了PHP中db_fatal_error函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fatal_error函数的具体用法?PHP db_fatal_error怎么用?PHP db_fatal_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: smf_db_initiate

function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_options = array())
{
    global $mysql_set_mode;
    if (!empty($db_options['persist'])) {
        $connection = @mysql_pconnect($db_server, $db_user, $db_passwd);
    } else {
        $connection = @mysql_connect($db_server, $db_user, $db_passwd);
    }
    // Something's wrong, show an error if its fatal (which we assume it is)
    if (!$connection) {
        if (!empty($db_options['non_fatal'])) {
            return null;
        } else {
            db_fatal_error();
        }
    }
    // Select the database, unless told not to
    if (empty($db_options['dont_select_db']) && !@mysql_select_db($db_name, $connection) && empty($db_options['non_fatal'])) {
        db_fatal_error();
    }
    // This makes it possible to have SMF automatically change the sql_mode and autocommit if needed.
    if (isset($mysql_set_mode) && $mysql_set_mode === true) {
        smf_db_query('SET sql_mode = \'\', AUTOCOMMIT = 1', array(), false);
    }
    return $connection;
}
开发者ID:norv,项目名称:EosAlpha,代码行数:26,代码来源:Subs-Db-mysql.php

示例2: smf_db_initiate

function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options = array())
{
    global $smcFunc, $mysql_set_mode;
    // Map some database specific functions, only do this once.
    if (!isset($smcFunc['db_fetch_assoc']) || $smcFunc['db_fetch_assoc'] != 'mysql_fetch_assoc') {
        $smcFunc += array('db_query' => 'smf_db_query', 'db_quote' => 'smf_db_quote', 'db_fetch_assoc' => 'mysql_fetch_assoc', 'db_fetch_row' => 'mysql_fetch_row', 'db_free_result' => 'mysql_free_result', 'db_insert' => 'smf_db_insert', 'db_insert_id' => 'smf_db_insert_id', 'db_num_rows' => 'mysql_num_rows', 'db_data_seek' => 'mysql_data_seek', 'db_num_fields' => 'mysql_num_fields', 'db_escape_string' => 'addslashes', 'db_unescape_string' => 'stripslashes', 'db_server_info' => 'mysql_get_server_info', 'db_affected_rows' => 'smf_db_affected_rows', 'db_transaction' => 'smf_db_transaction', 'db_error' => 'mysql_error', 'db_select_db' => 'mysql_select_db', 'db_title' => 'MySQL', 'db_sybase' => false, 'db_case_sensitive' => false, 'db_escape_wildcard_string' => 'smf_db_escape_wildcard_string');
    }
    if (!empty($db_options['persist'])) {
        $connection = @mysql_pconnect($db_server, $db_user, $db_passwd);
    } else {
        $connection = @mysql_connect($db_server, $db_user, $db_passwd);
    }
    // Something's wrong, show an error if its fatal (which we assume it is)
    if (!$connection) {
        if (!empty($db_options['non_fatal'])) {
            return null;
        } else {
            db_fatal_error();
        }
    }
    // Select the database, unless told not to
    if (empty($db_options['dont_select_db']) && !@mysql_select_db($db_name, $connection) && empty($db_options['non_fatal'])) {
        db_fatal_error();
    }
    // This makes it possible to have SMF automatically change the sql_mode and autocommit if needed.
    if (isset($mysql_set_mode) && $mysql_set_mode === true) {
        $smcFunc['db_query']('', 'SET sql_mode = \'\', AUTOCOMMIT = 1', array(), false);
    }
    return $connection;
}
开发者ID:abdulhadikaryana,项目名称:kebudayaan,代码行数:30,代码来源:Subs-Db-mysql.php

示例3: smf_db_initiate

function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, &$db_prefix, $db_options = array())
{
    global $smcFunc, $mysql_set_mode;
    // Map some database specific functions, only do this once.
    if (!isset($smcFunc['db_fetch_assoc']) || $smcFunc['db_fetch_assoc'] != 'postg_fetch_assoc') {
        $smcFunc += array('db_query' => 'smf_db_query', 'db_quote' => 'smf_db_quote', 'db_insert' => 'smf_db_insert', 'db_insert_id' => 'smf_db_insert_id', 'db_fetch_assoc' => 'smf_db_fetch_assoc', 'db_fetch_row' => 'smf_db_fetch_row', 'db_free_result' => 'pg_free_result', 'db_num_rows' => 'pg_num_rows', 'db_data_seek' => 'smf_db_data_seek', 'db_num_fields' => 'pg_num_fields', 'db_escape_string' => 'pg_escape_string', 'db_unescape_string' => 'smf_db_unescape_string', 'db_server_info' => 'smf_db_version', 'db_affected_rows' => 'smf_db_affected_rows', 'db_transaction' => 'smf_db_transaction', 'db_error' => 'pg_last_error', 'db_select_db' => 'smf_db_select_db', 'db_title' => 'PostgreSQL', 'db_sybase' => true, 'db_case_sensitive' => true, 'db_escape_wildcard_string' => 'smf_db_escape_wildcard_string');
    }
    if (!empty($db_options['persist'])) {
        $connection = @pg_pconnect('host=' . $db_server . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
    } else {
        $connection = @pg_connect('host=' . $db_server . ' dbname=' . $db_name . ' user=\'' . $db_user . '\' password=\'' . $db_passwd . '\'');
    }
    // Something's wrong, show an error if its fatal (which we assume it is)
    if (!$connection) {
        if (!empty($db_options['non_fatal'])) {
            return null;
        } else {
            db_fatal_error();
        }
    }
    return $connection;
}
开发者ID:valek0972,项目名称:hackits,代码行数:22,代码来源:Subs-Db-postgresql.php

示例4: smf_db_initiate

function smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, $db_prefix, $db_options = array())
{
    global $smcFunc, $mysql_set_mode, $db_in_transact, $sqlite_error;
    // Map some database specific functions, only do this once.
    if (!isset($smcFunc['db_fetch_assoc']) || $smcFunc['db_fetch_assoc'] != 'sqlite_fetch_array') {
        $smcFunc += array('db_query' => 'smf_db_query', 'db_quote' => 'smf_db_quote', 'db_fetch_assoc' => 'sqlite_fetch_array', 'db_fetch_row' => 'smf_db_fetch_row', 'db_free_result' => 'smf_db_free_result', 'db_insert' => 'smf_db_insert', 'db_insert_id' => 'smf_db_insert_id', 'db_num_rows' => 'sqlite_num_rows', 'db_data_seek' => 'sqlite_seek', 'db_num_fields' => 'sqlite_num_fields', 'db_escape_string' => 'sqlite_escape_string', 'db_unescape_string' => 'smf_db_unescape_string', 'db_server_info' => 'smf_db_libversion', 'db_affected_rows' => 'smf_db_affected_rows', 'db_transaction' => 'smf_db_transaction', 'db_error' => 'smf_db_last_error', 'db_select_db' => '', 'db_title' => 'SQLite', 'db_sybase' => true, 'db_case_sensitive' => true, 'db_escape_wildcard_string' => 'smf_db_escape_wildcard_string');
    }
    if (substr($db_name, -3) != '.db') {
        $db_name .= '.db';
    }
    if (!empty($db_options['persist'])) {
        $connection = @sqlite_popen($db_name, 0666, $sqlite_error);
    } else {
        $connection = @sqlite_open($db_name, 0666, $sqlite_error);
    }
    // Something's wrong, show an error if its fatal (which we assume it is)
    if (!$connection) {
        if (!empty($db_options['non_fatal'])) {
            return null;
        } else {
            db_fatal_error();
        }
    }
    $db_in_transact = false;
    // This is frankly stupid - stop SQLite returning alias names!
    @sqlite_query('PRAGMA short_column_names = 1', $connection);
    // Make some user defined functions!
    sqlite_create_function($connection, 'unix_timestamp', 'smf_udf_unix_timestamp', 0);
    sqlite_create_function($connection, 'inet_aton', 'smf_udf_inet_aton', 1);
    sqlite_create_function($connection, 'inet_ntoa', 'smf_udf_inet_ntoa', 1);
    sqlite_create_function($connection, 'find_in_set', 'smf_udf_find_in_set', 2);
    sqlite_create_function($connection, 'year', 'smf_udf_year', 1);
    sqlite_create_function($connection, 'month', 'smf_udf_month', 1);
    sqlite_create_function($connection, 'dayofmonth', 'smf_udf_dayofmonth', 1);
    sqlite_create_function($connection, 'concat', 'smf_udf_concat');
    sqlite_create_function($connection, 'locate', 'smf_udf_locate', 2);
    sqlite_create_function($connection, 'regexp', 'smf_udf_regexp', 2);
    return $connection;
}
开发者ID:Kheros,项目名称:MMOver,代码行数:39,代码来源:Subs-Db-sqlite.php

示例5: db_fatal_error

<?php

//Perform a SQL call that to get a list of all faculty who have set appointments in tbl_facAppts.
//The select <option value="uniqname">Full Name</option> is structured here (on the server side)
// and appended to the <select> statement object on the calling client page.
require_once $_SERVER["DOCUMENT_ROOT"] . "/../Support/configStudentVisit.php";
$facLstSQL = <<<SQL
\t\tSELECT *
\t\tFROM vw_facwithappts
\t\tORDER BY lname
SQL;
$facList = $db->query($facLstSQL);
if (!$facList) {
    db_fatal_error("facListing query issue", $db->error);
}
while ($items = $facList->fetch_assoc()) {
    echo "<option class='facSelect' value='" . $items['uniqname'] . "'>" . $items['fname'] . " " . $items['lname'] . "</option>";
}
$db->close();
开发者ID:rsmoke,项目名称:studentvisit,代码行数:19,代码来源:facListing.php

示例6: db_fatal_error

    echo "{$deptLngName}";
    ?>
 Reference Letter Request Admin Management interface</h1>
			<p>These are the current individuals who are permitted to manage the <?php 
    echo "{$deptLngName}";
    ?>
 Reference Letter Requests Application</p> 
		</div><!-- #instructions -->

		<div id="adminList">
			<span id="currAdmins">
	
		<?php 
    $queryRecord = 'SELECT * FROM SRL_tbl_Admin ORDER BY AdminUniqname ASC';
    if (!($result = $db->query($queryRecord))) {
        db_fatal_error('data select issue', $db->error, $queryRecord);
        exit($user_err_message);
    }
    while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
        $fullname = ldapGleaner($row['AdminUniqname']);
        echo '<div class="record" id="record-', $row['id'], '">
				<a href="?delete=', $row['id'], '" class="delete"><span style=color:red;font-weight:bold;>X</span></a>
				<strong>', $row['AdminUniqname'], '</strong>	-- ', $fullname[0], "&nbsp;", $fullname[1], '</div>';
    }
    ?>
			</span>
		</div><!-- testing delete -->
		<br />
		<div id="myAdminForm"><!-- add Admin -->
			If you would like to register another Administrator please enter their <b>uniqname</b> here
			<input type="text" name="name" />
开发者ID:rsmoke,项目名称:SocJobRefRequest,代码行数:31,代码来源:adminMngmt.php

示例7: header

// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename="EnglishKudos.csv"');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('RecordID', 'Uniqname', 'First Name', 'Last Name', 'Title', 'Type of Kudo', 'Edited By', 'Deleted'));
if ($login_name === "janej" || $login_name === "janesull" || $login_name === "rsmoke" || $login_name === "dporter") {
    $sqlSelect = <<<SQL
                SELECT
                    id,
                    uniqname,
                    userFname,
                    userLname,
                    kudoTitle,
                    kudoDesc,
                    kudoType,
                    edited,
                    selectedDelete
                FROM  tbl_kudos
                ORDER BY userLname ASC
SQL;
}
if (!($result = $db->query($sqlSelect))) {
    db_fatal_error("data select issue", $db->error);
    exit;
}
// loop over the rows, outputting them
while ($row = $result->fetch_assoc()) {
    fputcsv($output, $row);
}
开发者ID:rsmoke,项目名称:EnglishKudos,代码行数:31,代码来源:1441218826fileDownloader.php

示例8: loadDatabase

function loadDatabase()
{
    global $db_persist, $db_connection, $db_server, $db_user, $db_passwd;
    global $db_type, $db_name, $ssi_db_user, $ssi_db_passwd, $sourcedir, $db_prefix;
    // Figure out what type of database we are using.
    $db_type = 'mysql';
    // Load the file for the database.
    require_once $sourcedir . '/lib/Subs-Db-' . $db_type . '.php';
    // If we are in SSI try them first, but don't worry if it doesn't work, we have the normal username and password we can use.
    if (SMF == 'SSI' && !empty($ssi_db_user) && !empty($ssi_db_passwd)) {
        $db_connection = smf_db_initiate($db_server, $db_name, $ssi_db_user, $ssi_db_passwd, array('persist' => $db_persist, 'non_fatal' => true, 'dont_select_db' => true));
    }
    // Either we aren't in SSI mode, or it failed.
    if (empty($db_connection)) {
        $db_connection = smf_db_initiate($db_server, $db_name, $db_user, $db_passwd, array('persist' => $db_persist, 'dont_select_db' => SMF == 'SSI'));
    }
    // Safe guard here, if there isn't a valid connection lets put a stop to it.
    if (!$db_connection) {
        db_fatal_error();
    }
    // If in SSI mode fix up the prefix.
    if (SMF == 'SSI') {
        db_fix_prefix($db_prefix, $db_name);
    }
}
开发者ID:norv,项目名称:EosAlpha,代码行数:25,代码来源:Load.php

示例9: loadArcadeSettings

function loadArcadeSettings()
{
    global $arcSettings, $modSettings, $smcFunc;
    if (($arcSettings = cache_get_data('arcSettings', 90)) == null) {
        $request = $smcFunc['db_query']('', '
			SELECT variable, value
			FROM {db_prefix}arcade_settings', array());
        $arcSettings = array();
        if (!$request) {
            db_fatal_error();
        }
        while ($row = $smcFunc['db_fetch_row']($request)) {
            $arcSettings[$row[0]] = $row[1];
        }
        $smcFunc['db_free_result']($request);
        if (!empty($modSettings['cache_enable'])) {
            cache_put_data('arcSettings', $arcSettings, 90);
        }
    }
}
开发者ID:VBGAMER45,项目名称:SMFMods,代码行数:20,代码来源:Subs-Arcade.php

示例10: VALUES

    //insert data into database
    try {
        $sql = "INSERT INTO `tbl_kudos` (`userFname`, `userLname`, `uniqname`, `kudoType`, `kudoTitle`, `kudoDesc`) VALUES ('{$userFname}', '{$userLname}', '{$uniqname}', '{$kudoType}', '{$kudoTitle}', '{$kudoDesc}')";
        if ($db->query($sql) === true) {
            $_SESSION['userEntry'] = $db->insert_id;
            //echo "New record created successfully";
            $userFname = "";
            $userLname = "";
            $kudoType = "";
            $kudoTitle = "";
            $kudoDesc = "";
            unset($_POST["submit"]);
            redirect_to("confirm.php");
            exit;
        } else {
            die(db_fatal_error("Database query failed. "));
        }
        $db->close();
    } catch (Exception $e) {
        $result[] = $e->getMessage();
    }
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>LSA-<?php 
echo "{$pageTitle}";
?>
</title>
开发者ID:rsmoke,项目名称:EnglishKudos,代码行数:31,代码来源:index.php

示例11: session_start

<?php

require_once $_SERVER["DOCUMENT_ROOT"] . '/../Support/configEnglishContest.php';
require_once $_SERVER["DOCUMENT_ROOT"] . '/../Support/basicLib.php';
if (session_status() == PHP_SESSION_NONE) {
    session_start();
}
$idSent = htmlspecialchars($_POST['delid']);
if ($_SESSION['isAdmin']) {
    if ($idSent != 1) {
        $sqlDelete = <<<_SQL
            DELETE FROM tbl_contestadmin
            WHERE id = {$idSent};
_SQL;
        if (!($result = $db->query($sqlDelete))) {
            db_fatal_error("data delete issue", $db->error, $sqlDelete, $login_name);
            exit;
        }
        echo "Deleted admin ID: " . $idSent;
    } else {
        echo "nothin doin";
    }
} else {
    echo "unauthorized";
}
开发者ID:rsmoke,项目名称:hopwoodadmin,代码行数:25,代码来源:deleteAdm.php

示例12: header

if (isset($_POST["confirmEntry"])) {
    //do check related stuff
    header("Location: " . "https://webapps.lsa.umich.edu/english/secure/userservices/profile.asp");
    exit;
} elseif (isset($_POST["deleteentry"])) {
    //preserve entry but mark a cancelled"
    $cancelquery = "UPDATE tbl_kudos SET ";
    $cancelquery .= "selectedDelete = 'deleted' ";
    $cancelquery .= "WHERE id = {$recordID}";
    if ($result = $db->query($cancelquery)) {
        $db->close();
        //sending user to an address outside of this webapp
        header("Location: " . "https://webapps.lsa.umich.edu/english/secure/userservices/profile.asp");
        exit;
    } else {
        die(db_fatal_error("Database query failed for cancel. "));
    }
} else {
    $message = "Please review your information";
    $sql = "SELECT * ";
    $sql .= "FROM tbl_kudos ";
    $sql .= "WHERE id={$recordID}";
    $result = $db->query($sql);
    if ($result && $result->num_rows > 0) {
        // 3. Use returned data (if any)
        while ($subject = mysqli_fetch_assoc($result)) {
            // output data from each row
            ?>
<!DOCTYPE html>
<html lang="en">
  <head>
开发者ID:rsmoke,项目名称:EnglishKudos,代码行数:31,代码来源:confirm.php

示例13: db_fatal_error

}
if (!$stmt->bind_param('issss', $contestsID, $contestOpen, $contestClose, $contestNotes, $login_name)) {
    db_fatal_error("Bind parameters failed", "( " . $stmt->errno . " )" . $stmt->error, "EMPTY", $login_name);
    exit($user_err_message);
}
if (isset($_POST['insertContest'])) {
    $contestsID = $db->real_escape_string(htmlspecialchars($_POST['contestID']));
    $contestNotes = $db->real_escape_string(htmlspecialchars($_POST['notes']));
    $contestOpen = date("Y-m-d H:i:s", strtotime($_POST['openDate']));
    $contestClose = date("Y-m-d H:i:s", strtotime($_POST['closeDate']));
    if ($stmt->execute()) {
        $_SESSION['flashMessage'] = "Successfully added new contest";
        $_POST['insertContest'] = false;
        safeRedirect('contestAdmin.php');
    } else {
        db_fatal_error("Execute failed", "( " . $stmt->errno . " )" . $stmt->error, "EMPTY", $login_name);
        exit($user_err_message);
    }
} else {
    $contestsID = $contestNotes = $contestOpen = $contestClose = null;
    $_SESSION['flashMessage'] = "";
    $_POST['insertContest'] = false;
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>LSA-<?php 
echo "{$contestTitle}";
?>
开发者ID:rsmoke,项目名称:hopwoodadmin,代码行数:31,代码来源:newContestSubmit.php

示例14: db_fatal_error

          <div id="instructions">
            <p>These are the current individuals who are permitted to manage the <?php 
    echo "{$contestTitle}";
    ?>
 Application</p>
            </div><!-- #instructions -->
            <div id="adminList">
              <span id="currAdmins">
                <?php 
    $sqlAdmSel = <<<SQL
                SELECT *
                FROM tbl_contestadmin
                ORDER BY uniqname
SQL;
    if (!($resADM = $db->query($sqlAdmSel))) {
        db_fatal_error("data read issue", $db->error, $sqlAdmSel, $login_name);
        exit;
    }
    while ($row = $resADM->fetch_assoc()) {
        $fullname = ldapGleaner($row['uniqname']);
        echo '<div class="record">
                  <button type="button" class="btn btn-xs btn-danger btnDelADM" data-delid="' . $row['id'] . '"><span class="glyphicon glyphicon-remove"></span></button>
                <strong>' . $row['uniqname'] . '</strong>  -- ' . $fullname[0] . " " . $fullname[1] . '</div>';
    }
    ?>
              </span>
            </div>
            <br />
            <div id="myAdminForm"><!-- add Admin -->
            To add an Administrator please enter their <b>uniqname</b> below:<br>
            <input class="form_control" type="text" name="name" /><br>
开发者ID:rsmoke,项目名称:hopwoodadmin,代码行数:31,代码来源:index.php

示例15: unset

        $_SESSION['stuLname'] = NULL;
        $_SESSION['stuID'] = NULL;
        unset($_POST['logout']);
        $showChkList = false;
        redirect_to("index.php");
    }
} elseif (isset($_POST['logon'])) {
    // form was submitted
    $stuVisUsername = htmlentities($_POST['stuVisUsername']);
    $umid = htmlentities($_POST['umid']);
    $userSQL = "SELECT Fname, Lname, id ";
    $userSQL .= "FROM tbl_user ";
    $userSQL .= "WHERE password = '{$umid}' AND email = '{$stuVisUsername}' ";
    $userSQL .= "LIMIT 1";
    if (!($resStuDetails = $db->query($userSQL))) {
        db_fatal_error("login issue", $db->error);
    } else {
        if ($resStuDetails->num_rows == 1) {
            // successful login
            $_SESSION['stuVisUsername'] = $stuVisUsername;
            $_SESSION['umid'] = $umid;
            while ($items = $resStuDetails->fetch_assoc()) {
                $_SESSION['stuFname'] = $items['Fname'];
                $_SESSION['stuLname'] = $items['Lname'];
                $_SESSION['stuID'] = $items['id'];
            }
            $resStuDetails->close();
            $db->close();
            unset($_POST['logon']);
            $message = NULL;
            redirect_to("php/stuVisChklst.php");
开发者ID:rsmoke,项目名称:studentvisit,代码行数:31,代码来源:index.php


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