PHP Delete data table and delete database _php tutorial

Source: Internet
Author: User
PHP Delete data table and delete database


---------------------------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]. " `";
}
$sql 1= $empire->query ("DROP TABLE IF EXISTS". $a. ";");
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)");}
}


http://www.bkjia.com/PHPjc/445030.html www.bkjia.com true http://www.bkjia.com/PHPjc/445030.html techarticle PHP Delete data table and delete database//---------------------------Delete data table function Ebak_drop ($tablename, $dbname) {global $empire; $ Dbname=reppostvar ($dbname); $empire-quer ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.