Files
phpmyadmin/tbl_rename.php3
2001-09-08 12:59:45 +00:00

49 lines
997 B
PHP
Executable File

<?php
/* $Id$ */
/**
* Gets some core libraries
*/
require('./libraries/grab_globals.lib.php3');
$js_to_run = 'functions.js';
require('./libraries/common.lib.php3');
/**
* A new name has been submitted -> do the work
*/
if (isset($new_name) && trim($new_name) != '') {
$old_name = $table;
$table = $new_name;
if (get_magic_quotes_gpc()) {
$new_name = stripslashes($new_name);
}
if (MYSQL_INT_VERSION < 32306) {
check_reserved_words($new_name);
}
include('./header.inc.php3');
mysql_select_db($db);
$sql_query = 'ALTER TABLE ' . backquote($old_name) . ' RENAME ' . backquote($new_name);
$result = mysql_query($sql_query) or mysql_die();
$message = sprintf($strRenameTableOK, $old_name, $table);
$reload = 1;
}
/**
* No new name for the table!
*/
else {
include('./header.inc.php3');
mysql_die($strTableEmpty);
}
/**
* Back to the calling script
*/
require('./tbl_properties.php3');
?>