optimized the "DROP FIELD" case
This commit is contained in:
@@ -51,11 +51,20 @@ if (!empty($submit_mult)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'drop_fld':
|
case 'drop_fld':
|
||||||
$full_query .= 'ALTER TABLE '
|
if ($full_query == '') {
|
||||||
. backquote(htmlspecialchars($table))
|
$full_query .= 'ALTER TABLE '
|
||||||
. ' DROP '
|
. backquote(htmlspecialchars($table))
|
||||||
. backquote(htmlspecialchars(urldecode($selected[$i])))
|
. '<br /> DROP '
|
||||||
. ';<br />';
|
. backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||||
|
. ',';
|
||||||
|
} else {
|
||||||
|
$full_query .= '<br /> DROP '
|
||||||
|
. backquote(htmlspecialchars(urldecode($selected[$i])))
|
||||||
|
. ',';
|
||||||
|
}
|
||||||
|
if ($i == $selected_cnt-1) {
|
||||||
|
$full_query = ereg_replace(',$', ';<br />', $full_query);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
}
|
}
|
||||||
@@ -118,20 +127,39 @@ else if ((get_magic_quotes_gpc() && stripslashes($btnDrop) == $strYes)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'drop_fld':
|
case 'drop_fld':
|
||||||
$a_query = 'ALTER TABLE '
|
if ($sql_query == '') {
|
||||||
. backquote($table)
|
$sql_query .= 'ALTER TABLE '
|
||||||
. ' DROP '
|
. backquote($table)
|
||||||
. backquote(urldecode($selected[$i]));
|
. ' DROP '
|
||||||
|
. backquote(urldecode($selected[$i]))
|
||||||
|
. ',';
|
||||||
|
} else {
|
||||||
|
$sql_query .= ' DROP '
|
||||||
|
. backquote(urldecode($selected[$i]))
|
||||||
|
. ',';
|
||||||
|
}
|
||||||
|
if ($i == $selected_cnt-1) {
|
||||||
|
$sql_query = ereg_replace(',$', ';', $sql_query);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
$sql_query .= $a_query . ';' . "\n";
|
|
||||||
|
|
||||||
if ($query_type != 'drop_db') {
|
// All "drop field" statements will be run at once below
|
||||||
mysql_select_db($db);
|
if ($query_type != 'drop_fld') {
|
||||||
}
|
$sql_query .= $a_query . ';' . "\n";
|
||||||
$result = @mysql_query($a_query) or mysql_die('', $a_query, FALSE);
|
|
||||||
|
if ($query_type != 'drop_db') {
|
||||||
|
mysql_select_db($db);
|
||||||
|
}
|
||||||
|
$result = @mysql_query($a_query) or mysql_die('', $a_query, FALSE);
|
||||||
|
} // end if
|
||||||
} // end for
|
} // end for
|
||||||
|
|
||||||
|
if ($query_type == 'drop_fld') {
|
||||||
|
mysql_select_db($db);
|
||||||
|
$result = @mysql_query($sql_query) or mysql_die('', '', FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
show_message($strSuccess);
|
show_message($strSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user