Delete data tables and databases in php
// ----------------------------- Delete a data table
Function Ebak_Drop ($ tablename, $ dbname ){
Global $ empire;
$ Dbname = RepPostVar ($ dbname );
$ Empire-> query ("use '$ dbname '");
$ Count = count ($ tablename );
If (empty ($ count ))
{Printerror ("EmptyChangeDelTb", "history. go (-1 )");}
$ A = "";
$ First = 1;
For ($ I = 0; $ I <$ count; $ I ++)
{
If (empty ($ first ))
{
$ A. = ",";
}
Else
{
$ First = 0;
}
$ A. = "'". $ tablename [$ I]. "'";
}
$ Sql1 = $ empire-> query ("drop table if exists". $ .";");
Printerror ("DelTbSuccess", "ChangeTable. php? Mydbname = $ dbname ");
}
// -------------------------- Delete a database
Function Ebak_DropDb ($ dbname ){
Global $ empire;
$ Dbname = RepPostVar ($ dbname );
If (empty ($ dbname ))
{
Printerror ("NotChangeDelDb", "history. go (-1 )");
}
$ SQL = $ empire-> query ("DROP DATABASE '$ dbname '");
If ($ SQL)
{
Printerror ("DelDbSuccess", "ChangeDb. php ");
}
Else
{Printerror ("DbError", "history. go (-1 )");}
}