• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP mysql_die函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_table_content

 function get_table_content($db, $table, $handler)
 {
     $result = mysql_db_query($db, "SELECT * FROM {$table}") or mysql_die();
     $i = 0;
     while ($row = mysql_fetch_row($result)) {
         $table_list = "(";
         for ($j = 0; $j < mysql_num_fields($result); $j++) {
             $table_list .= mysql_field_name($result, $j) . ",";
         }
         $table_list = substr($table_list, 0, -2);
         $table_list .= ")";
         if (isset($GLOBALS["showcolumns"])) {
             $schema_insert = "INSERT INTO {$table} {$table_list} VALUES (";
         } else {
             $schema_insert = "INSERT INTO {$table} VALUES (";
         }
         for ($j = 0; $j < mysql_num_fields($result); $j++) {
             if (!isset($row[$j])) {
                 $schema_insert .= " NULL,";
             } elseif ($row[$j] != "") {
                 $schema_insert .= " '" . addslashes($row[$j]) . "',";
             } else {
                 $schema_insert .= " '',";
             }
         }
         $schema_insert = ereg_replace(",\$", "", $schema_insert);
         $schema_insert .= ")";
         $handler(trim($schema_insert));
         $i++;
     }
     return true;
 }
开发者ID:philum,项目名称:cms,代码行数:32,代码来源:dump.php


示例2: SyncDBContent

 function SyncDBContent($db_host = "", $db_name = "", $db_user = "", $db_user = "")
 {
     $this->db_name = $db_name;
     $this->db_link = @mysql_connect($db_host, $db_user, $db_pass) or mysql_die();
     mysql_select_db($this->db_name) or mysql_die();
     $this->db_tables = $this->get_tablenames();
 }
开发者ID:umahatokula,项目名称:academia,代码行数:7,代码来源:SyncDBContent.php


示例3: my_handler

/**
 * Insert datas from one table to another one
 *
 * @param   string  the original insert statement
 *
 * @global  string  the database name
 * @global  string  the original table name
 * @global  string  the target database and table names
 * @global  string  the sql query used to copy the data
 */
function my_handler($sql_insert = '')
{
    global $db, $table, $target;
    global $sql_insert_data;
    $sql_insert = eregi_replace('INSERT INTO (`?)' . $table . '(`?)', 'INSERT INTO ' . $target, $sql_insert);
    $result = mysql_query($sql_insert) or mysql_die('', $sql_insert);
    $sql_insert_data .= $sql_insert . ';' . "\n";
}
开发者ID:CMMCO,项目名称:Intranet,代码行数:18,代码来源:tbl_copy.php


示例4: mysql_die

 if (!empty($lastname_per)) {
     // Look if contact is in table
     $columns = "*";
     $tables = "contact";
     $where = "conid='{$id}'";
     if (!$db->query("SELECT {$columns} FROM {$tables} WHERE {$where}")) {
         mysql_die($db);
     } else {
         // If contact in table
         if ($db->next_record()) {
             if ($db->f("user") == $auth->auth["uname"] || $perm->have_perm("admin")) {
                 // Insert new contact person
                 $tables = "persons";
                 $set = "conid_per='{$id}',salutation_per='{$salutation_per}',firstname_per='{$firstname_per}',lastname_per='{$lastname_per}',grad_per='{$grad_per}',position_per='{$position_per}',phone_per='{$phone_per}',fax_per='{$fax_per}',email_per='{$email_per}',homepage_per='{$homepage_per}',comment_per='{$comment_per}',status_per='A',modification_per=NOW(),creation_per=NOW()";
                 if (!$db->query("INSERT {$tables} SET {$set}")) {
                     mysql_die($db);
                 }
                 // Select and show new/updated contact with contact persons
                 conbyconid($db, $id);
                 perbyconid($db, $id);
                 if ($ml_notify) {
                     $msg = "insert contact person \"{$firstname_per} {$lastname_per}\" of contact (ID: {$id}) by " . $auth->auth["uname"] . ".";
                     mailuser("admin", "insert contact person", $msg);
                 }
             } else {
                 $be->box_full($t->translate("Error"), $t->translate("Access denied"));
             }
             // If contact is not in table
         } else {
             $be->box_full($t->translate("Error"), $t->translate("Contact") . " (ID: {$id}) " . $t->translate("does not exist") . ".");
         }
开发者ID:BackupTheBerlios,项目名称:sourcecontact,代码行数:31,代码来源:perins.php


示例5: mysql_die

<?php

/* $Id: tbl_select.php,v 1.17 2001/08/29 12:00:07 loic1 Exp $ */
/**
 * Gets some core libraries
 */
require './grab_globals.inc.php';
require './lib.inc.php';
/**
 * Not selection yet required -> displays the selection form
 */
if (!isset($param) || $param[0] == '') {
    include './header.inc.php';
    $result = @mysql_list_fields($db, $table);
    if (!$result) {
        mysql_die('', 'mysql_list_fields(' . $db . ', ' . $table . ')');
    } else {
        // Gets the list and number of fields
        $fields_count = mysql_num_fields($result);
        for ($i = 0; $i < $fields_count; $i++) {
            $fields_list[] = mysql_field_name($result, $i);
            $fields_type[] = mysql_field_type($result, $i);
            $fields_len[] = mysql_field_len($result, $i);
        }
        ?>
<form method="post" action="tbl_select.php">
    <input type="hidden" name="server" value="<?php 
        echo $server;
        ?>
" />
    <input type="hidden" name="lang" value="<?php 
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:tbl_select.php


示例6: backquote

            $sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')';
            $result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD INDEX (' . $index . ')') or mysql_die();
        }
    }
    // end if
    // Builds the uniques statements and updates the table
    $unique = '';
    if (isset($field_unique)) {
        for ($i = 0; $i < count($field_unique); $i++) {
            $j = $field_unique[$i];
            $unique .= backquote($field_name[$j]) . ', ';
        }
        // end for
        $unique = ereg_replace(', $', '', $unique);
        if (!empty($unique)) {
            $sql_query .= "\n" . 'ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')';
            $result = mysql_query('ALTER TABLE ' . backquote($db) . '.' . backquote($table) . ' ADD UNIQUE (' . $unique . ')') or mysql_die();
        }
    }
    // end if
    // Go back to table properties
    $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenAltered;
    include './tbl_properties.php';
    exit;
} else {
    $action = 'tbl_addfield.php';
    include './tbl_properties.inc.php';
    // Diplays the footer
    echo "\n";
    include './footer.inc.php';
}
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:tbl_addfield.php


示例7: dbn

function dbn($string)
{
    global $database_link;
    mysql_query($string, $database_link) or mysql_die($string);
}
开发者ID:nilsine,项目名称:Astra-Vires,代码行数:5,代码来源:common.inc.php


示例8: GetRowByQuery

/** Runs '$query' and returns the first (arbitrarily) found row.
 */
function GetRowByQuery($query)
{
    $QueryResult = mysql_query($query) or mysql_die($query);
    $Result = mysql_fetch_array($QueryResult);
    return $Result;
}
开发者ID:EQMacEmu,项目名称:allaclone,代码行数:8,代码来源:mysql.php


示例9: sql_addslashes

    // Adds table type (2 May 2001 - Robbat2)
    if (!empty($tbl_type) && $tbl_type != 'Default') {
        $sql_query .= ' TYPE = ' . $tbl_type;
    }
    if (MYSQL_INT_VERSION >= 32300 && !empty($comment)) {
        $sql_query .= ' comment = \'' . sql_addslashes($comment) . '\'';
    }
    // Executes the query
    $result = mysql_query($sql_query) or mysql_die();
    $message = $strTable . ' ' . htmlspecialchars($table) . ' ' . $strHasBeenCreated;
    include './tbl_properties.php';
    exit;
} else {
    if (isset($num_fields)) {
        $num_fields = intval($num_fields);
    }
    // No table name
    if (!isset($table) || trim($table) == '') {
        mysql_die($strTableEmpty);
    } else {
        if (empty($num_fields) || !is_int($num_fields)) {
            mysql_die($strFieldsEmpty);
        } else {
            $action = 'tbl_create.php';
            include './tbl_properties.inc.php';
            // Diplays the footer
            echo "\n";
            include './footer.inc.php';
        }
    }
}
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:tbl_create.php


示例10: get_table_def

 function get_table_def($db, $table, $crlf)
 {
     $schema_create = "";
     //$schema_create .= "DROP TABLE IF EXISTS $table;$crlf";
     $schema_create .= "CREATE TABLE {$table} ({$crlf}";
     $result = mysql_db_query($db, "SHOW FIELDS FROM {$table}") or mysql_die();
     while ($row = mysqli_fetch_array($result)) {
         $schema_create .= "   {$row['Field']} {$row['Type']}";
         if (isset($row["Default"]) && (!empty($row["Default"]) || $row["Default"] == "0")) {
             $schema_create .= " DEFAULT '{$row['Default']}'";
         }
         if ($row["Null"] != "YES") {
             $schema_create .= " NOT NULL";
         }
         if ($row["Extra"] != "") {
             $schema_create .= " {$row['Extra']}";
         }
         $schema_create .= ",{$crlf}";
     }
     $schema_create = ereg_replace("," . $crlf . "\$", "", $schema_create);
     $result = mysql_db_query($db, "SHOW KEYS FROM {$table}") or mysql_die();
     while ($row = mysqli_fetch_array($result)) {
         $kname = $row['Key_name'];
         if ($kname != "PRIMARY" && $row['Non_unique'] == 0) {
             $kname = "UNIQUE|{$kname}";
         }
         if (!isset($index[$kname])) {
             $index[$kname] = array();
         }
         $index[$kname][] = $row['Column_name'];
     }
     while (list($x, $columns) = @each($index)) {
         $schema_create .= ",{$crlf}";
         if ($x == "PRIMARY") {
             $schema_create .= "   PRIMARY KEY (" . implode($columns, ", ") . ")";
         } elseif (substr($x, 0, 6) == "UNIQUE") {
             $schema_create .= "   UNIQUE " . substr($x, 7) . " (" . implode($columns, ", ") . ")";
         } else {
             $schema_create .= "   KEY {$x} (" . implode($columns, ", ") . ")";
         }
     }
     $schema_create .= "{$crlf})";
     return stripslashes($schema_create);
 }
开发者ID:rotvulpix,项目名称:php-nuke,代码行数:44,代码来源:backup.php


示例11: showRelated

 function showRelated($foreign_table = false, $opts = false)
 {
     if (is_array($opts)) {
         extract($opts);
     }
     if ($foreign_table) {
         $sql = " SELECT * FROM {$foreign_table} WHERE {$this->_indexField} = {$this->id} ";
         $result = mysql_db_query($this->_db, $sql) or mysql_die($sql);
         if ($debug) {
             echo "<hr><pre> {$sql} </pre><hr>";
         }
         if ($get_result) {
             return $result;
         }
         // It would be nice to use the object here, and be able to customize with the $this->summary_link function.
         if (class_exists($foreign_table)) {
             while ($row = mysql_fetch_array($result)) {
                 $object = new $table($row[0]);
                 $object->summary_link();
             }
         } else {
             // get the title field
             $sql = "";
         }
     }
 }
开发者ID:jonah,项目名称:ActiveCoreDBOS,代码行数:26,代码来源:DBOS.class.php


示例12: exists

 public function exists($id = '')
 {
     $idf = $this->_idField;
     if ($id === '') {
         $id = $this->getId();
     }
     // bail if a lookup would obviously fail
     if (!$this->hasId()) {
         return false;
     }
     $sql = "SELECT `{$this->_idField}` FROM `{$this->_table}` WHERE `{$this->_idField}` = '{$id}'";
     $foundit = false;
     if ($res = mysql_db_query($this->_db, $sql) or mysql_die($sql)) {
         if (mysql_num_rows($res) == 1) {
             $found_id = mysql_result($res, 0, 0);
             if ($found_id == $id) {
                 $foundit = true;
             }
         }
         mysql_free_result($res);
     }
     return $foundit;
 }
开发者ID:jonah,项目名称:ActiveCoreDBOS,代码行数:23,代码来源:DBObjectAC.class.php


示例13: array

 if ($num_dbs) {
     $true_dblist = array();
     for ($i = 0; $i < $num_dbs; $i++) {
         $dblink = @mysql_select_db($dblist[$i]);
         if ($dblink) {
             $true_dblist[] = $dblist[$i];
         }
         // end if
     }
     // end for
     unset($dblist);
     $dblist = $true_dblist;
     unset($true_dblist);
     $num_dbs = count($dblist);
 } else {
     $dbs = mysql_list_dbs() or mysql_die('', 'mysql_list_dbs()', FALSE, FALSE);
     $num_dbs = @mysql_num_rows($dbs);
     $real_num_dbs = 0;
     for ($i = 0; $i < $num_dbs; $i++) {
         $db_name_tmp = mysql_dbname($dbs, $i);
         //echo $db_name_tmp."<br>";
         if ($db_name_tmp != "test") {
             $dblink = @mysql_select_db($db_name_tmp);
             if ($dblink) {
                 $dblist[] = $db_name_tmp;
                 $real_num_dbs++;
             }
         }
     }
     // end for
     $num_dbs = $real_num_dbs;
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:left.php


示例14: get_table_content

function get_table_content($src_table, $dest_table, $crlf, $escape, &$stream = null)
{
    $out = '';
    $table_list = '';
    $result = mysql_query("SELECT * FROM {$src_table}") or mysql_die();
    $i = 0;
    $block_size = 100;
    while ($row = mysql_fetch_row($result)) {
        if (empty($table_list)) {
            $table_list = "(";
            for ($j = 0; $j < mysql_num_fields($result); $j++) {
                $table_list .= $escape . mysql_field_name($result, $j) . $escape . ", ";
            }
            $table_list = substr($table_list, 0, -2);
            $table_list .= ")";
        }
        if ($i % $block_size == 0) {
            $schema_insert = ';' . $crlf . 'INSERT INTO ' . $escape . $dest_table . $escape . ' ' . $table_list . ' VALUES' . $crlf . '(';
        } else {
            $schema_insert = ",{$crlf}(";
        }
        for ($j = 0; $j < mysql_num_fields($result); $j++) {
            if (!isset($row[$j])) {
                $schema_insert .= " NULL,";
            } elseif ($row[$j] != "") {
                $schema_insert .= " '" . mysql_real_escape_string($row[$j]) . "',";
            } else {
                $schema_insert .= " '',";
            }
        }
        $schema_insert = ereg_replace(",\$", "", $schema_insert);
        $schema_insert .= ")";
        if (!empty($stream)) {
            fputs($stream, $schema_insert);
        } else {
            $out .= $schema_insert;
        }
        $i++;
    }
    if (!empty($stream)) {
        return true;
    }
    return $out . ';' . $crlf;
}
开发者ID:albinguillaume,项目名称:testMO,代码行数:44,代码来源:library.inc.php


示例15: get_table_csv

 /**
  * Outputs the content of a table in CSV format
  *
  * Last revision 14 July 2001: Patch for limiting dump size from
  * [email protected] & [email protected]
  *
  * @param   string   the database name
  * @param   string   the table name
  * @param   integer  the offset on this table
  * @param   integer  the last row to get
  * @param   string   the field separator character
  * @param   string   the optionnal "enclosed by" character
  * @param   string   the handler (function) to call. It must accept one
  *                   parameter ($sql_insert)
  *
  * @global  string   whether to obtain an excel compatible csv format or a
  *                   simple csv one
  *
  * @return  boolean always true
  */
 function get_table_csv($db, $table, $limit_from = 0, $limit_to = 0, $sep, $enc_by, $esc_by, $handler)
 {
     global $what;
     // Handles the "separator" and the optionnal "enclosed by" characters
     if (empty($sep) || $what == 'excel') {
         $sep = ';';
     } else {
         if (get_magic_quotes_gpc()) {
             $sep = stripslashes($sep);
         }
         $sep = str_replace('\\t', "\t", $sep);
     }
     if (empty($enc_by) || $what == 'excel') {
         $enc_by = '"';
     } else {
         if (get_magic_quotes_gpc()) {
             $enc_by = stripslashes($enc_by);
         }
         $enc_by = str_replace('&quot;', '"', $enc_by);
     }
     if (empty($esc_by) || $what == 'excel') {
         // double the "enclosed by" character
         $esc_by = $enc_by;
     } else {
         if (get_magic_quotes_gpc()) {
             $esc_by = stripslashes($esc_by);
         }
     }
     // Defines the offsets to use
     if ($limit_from > 0) {
         $limit_from--;
     } else {
         $limit_from = 0;
     }
     if ($limit_to > 0 && $limit_from >= 0) {
         $add_query = " LIMIT {$limit_from}, {$limit_to}";
     } else {
         $add_query = '';
     }
     // Gets the data from the database
     $local_query = 'SELECT * FROM ' . backquote($db) . '.' . backquote($table) . $add_query;
     $result = mysql_query($local_query) or mysql_die('', $local_query);
     // Format the data
     $i = 0;
     while ($row = mysql_fetch_row($result)) {
         @set_time_limit(60);
         $schema_insert = '';
         $fields_cnt = mysql_num_fields($result);
         for ($j = 0; $j < $fields_cnt; $j++) {
             if (!isset($row[$j])) {
                 $schema_insert .= 'NULL';
             } else {
                 if ($row[$j] != '') {
                     // loic1 : always enclose fields
                     if ($what == 'excel') {
                         $row[$j] = ereg_replace("\r(\n)?", "\n", $row[$j]);
                     }
                     $schema_insert .= $enc_by . str_replace($enc_by, $esc_by . $enc_by, $row[$j]) . $enc_by;
                 } else {
                     $schema_insert .= '';
                 }
             }
             if ($j < $fields_cnt - 1) {
                 $schema_insert .= $sep;
             }
         }
         // end for
         $handler(trim($schema_insert));
         ++$i;
     }
     // end while
     return TRUE;
 }
开发者ID:CMMCO,项目名称:Intranet,代码行数:93,代码来源:lib.inc.php


示例16: COUNT

 // this case)
 if ($is_delete && eregi('^DELETE( .+)?( FROM (.+))$', $sql_query, $parts) && !eregi(' WHERE ', $parts[3])) {
     $OPresult = @mysql_query('SELECT COUNT(*) as count' . $parts[2]);
     if ($OPresult) {
         $num_rows = mysql_result($OPresult, 0, 'count');
     } else {
         $num_rows = 0;
     }
 }
 // Executes the query
 $result = @mysql_query($full_sql_query);
 // Displays an error message if required and stop parsing the script
 if (mysql_error()) {
     $error = mysql_error();
     include './header.inc.php';
     mysql_die($error, $full_sql_query);
 }
 // Gets the number of rows affected/returned
 if (!$is_affected) {
     $num_rows = @mysql_num_rows($result);
 } else {
     if (!isset($num_rows)) {
         $num_rows = @mysql_affected_rows();
     }
 }
 // Counts the total number of rows for the same 'SELECT' query without the
 // 'LIMIT' clause that may have been programatically added
 if (empty($sql_limit_to_append)) {
     $SelectNumRows = $num_rows;
 } else {
     if ($is_select) {
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:sql.php


示例17: mysql_select_db

<?php

/* $Id: tbl_rename.php,v 1.7 2001/08/22 20:42:51 loic1 Exp $ */
/**
 * Gets some core libraries
 */
require './grab_globals.inc.php';
require './lib.inc.php';
/**
 * A new name has been submitted -> do the work
 */
if (isset($new_name) && trim($new_name) != '') {
    $old_name = $table;
    $table = $new_name;
    include './header.inc.php';
    mysql_select_db($db);
    $local_query = 'ALTER TABLE ' . backquote($old_name) . ' RENAME ' . backquote($new_name);
    $result = mysql_query($local_query) or mysql_die('', $local_query);
    $message = sprintf($strRenameTableOK, $old_name, $table);
    $reload = 'true';
} else {
    include './header.inc.php';
    mysql_die($strTableEmpty);
}
/**
 * Back to the calling script
 */
require './tbl_properties.php';
开发者ID:CMMCO,项目名称:Intranet,代码行数:28,代码来源:tbl_rename.php


示例18: db

     #delta bomb
     #clear all shields on all ships before we start.
     db("select s.ship_id from {$db_name}_ships s, {$db_name}_users u where s.location = '{$user['location']}' && u.login_id\t!= 1 && s.ship_id > 1 && s.login_id = u.login_id && u.turns_run > '{$turns_safe}'");
     while ($target_ship = dbr(1)) {
         dbn("update {$db_name}_ships set shields = 0 where ship_id = '{$target_ship['ship_id']}'");
     }
     $target_ship = "";
     $bomb_damage = 5000;
 }
 if ($star['event_random'] == 2) {
     $bomb_damage *= 3;
 }
 $ship_counter = 0;
 $dam_victim = array();
 $destroyed_ships = 0;
 $lastresort = mysql_query("select s.fighters,s.shields,s.ship_id,s.metal,s.fuel,s.location,s.login_id,s.class_name,s.ship_name,s.point_value,u.login_name from {$db_name}_ships s,{$db_name}_users u where s.location = '{$user['location']}' && s.ship_id > '1' && s.login_id >'1' && s.login_id = u.login_id && u.turns_run >= '{$turns_safe}'") or mysql_die("Bombs are messed up.");
 $elim = 0;
 #loop through players to damage.
 while ($target_ship = mysql_fetch_array($lastresort)) {
     #db("select login_name,login_id,ship_id from ${db_name}_users where login_id = '$target_ship[login_id]'");
     #$target = dbr();
     $ship_counter++;
     $temp121 = 0;
     $temp121 = damage_ship($bomb_damage, 0, 0, $user, $target_ship, $target_ship);
     #Used to limit messages sent, so each player only gets 1 message.
     $dam_victim[$target_ship['login_id']] .= "\n<br /><b class='b1'>{$target_ship['ship_name']}</b> ({$target_ship['class_name']})";
     if ($temp121 > 0) {
         $dam_victim[$target_ship['login_id']] .= $st[1085];
         $elim++;
     }
 }
开发者ID:nilsine,项目名称:Astra-Vires,代码行数:31,代码来源:bombs.php


示例19: count

if (!empty($db)) {
    $db_start = $db;
}
// loic1: lib.inc.php will be loaded by header.inc.php
//require('./lib.inc.php');
require './header.inc.php';
/**
 * Get the list and number of available databases.
 * Skipped if no server selected: in this case no database should be displayed
 * before the user choose among available ones at the welcome screen.
 */
if ($server > 0) {
    //<
    // Get the valid databases list
    $num_dbs = count($dblist);
    $dbs = @mysql_list_dbs() or mysql_die('', 'mysql_list_dbs()');
    while ($a_db = mysql_fetch_object($dbs)) {
        if (!$num_dbs) {
            $dblist[] = $a_db->Database;
            //<
        } else {
            $true_dblist[$a_db->Database] = '';
            //<
        }
    }
    if ($num_dbs && empty($true_dblist)) {
        $dblist = array();
    } else {
        if ($num_dbs) {
            for ($i = 0; $i < $num_dbs; $i++) {
                if (isset($true_dblist[$dblist[$i]])) {
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:db_stats.php


示例20: mysql_query

 $rs_usr = mysql_query($local_query, $stdlink) or mysql_die('', $local_query, FALSE);
 $result_usr = mysql_fetch_array($rs_usr);
 $create = $result_usr['Create_priv'] == 'Y';
 $db_to_create = '';
 // Does user have Create priv on a inexistant db?
 // if yes, show him in the dialog the first inexistant db name that we
 // find, in most cases it's probably the one he just dropped :)
 // (Note: we only get here after a browser reload, I don't know why)
 if (!$create) {
     $userlink = @mysql_connect($cfgServer['host'] . $server_port . $server_socket, $cfgServer['user'], $cfgServer['password']);
     if ($userlink == FALSE) {
         $local_query = 'mysql_connect(' . $cfgServer['host'] . $server_port . $server_socket . ', ' . $cfgServer['user'] . ', ' . $cfgServer['password'] . ')';
         mysql_die('', $local_query, FALSE, FALSE);
     }
     $local_query = 'SELECT Db FROM mysql.db WHERE User = \'' . sql_addslashes($cfgServer['user']) . '\'';
     $rs_usr = mysql_query($local_query, $stdlink) or mysql_die('', $local_query, FALSE);
     while ($row = mysql_fetch_array($rs_usr)) {
         if (!mysql_select_db($row['Db'], $userlink)) {
             $db_to_create = $row['Db'];
             $create = TRUE;
             break;
         }
     }
 }
 // The user is allowed to create a db '
 if ($create) {
     echo "\n";
     ?>
 <!-- db creation form -->
 <tr>
     <td valign="baseline"><img src="images/item.gif" width="7" height="7" alt="item" /></td>
开发者ID:CMMCO,项目名称:Intranet,代码行数:31,代码来源:main.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP mysql_drop_db函数代码示例发布时间:2022-05-15
下一篇:
PHP mysql_db_query函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap