PHP Create data [crate database] and empty datasheet
function Ebak_creatdb ($dbname, $dbchar = ' ") {
Global $empire, $phome _db_ver;
$dbname =reppostvar ($dbname);
if (!trim ($dbname))
{
Printerror ("Emptydbname", "History.go (-1)");
}
$a = "";
if ($dbchar && $phome _db_ver>= ' 4.1 ')
{
$a = "DEFAULT CHARACTER SET". $dbchar;
}
$sql = $empire->query ("CREATE DATABASE IF not EXISTS ' $dbname '". $a);
if ($sql)
{
Printerror ("Createdbsuccess", "changedb.php");
}
Else
{Printerror ("Dberror", "History.go (-1)");}
}
//--------------------------Empty table
function ebak_emptytable ($tablename, $dbname) {
global $empire;
$dbname =reppostvar ($dbname);
$empire->query ("Use ' $dbname ')";
$count =count ($tablename);
if (Empty ($count))
{printerror ("Emptychangetb", "History.go (-1)");}
for ($i =0 $i < $count $i + +)
{
$sql 1= $empire->query ("TRUNCATE". $tablename [$i]. " `;");
}
printerror ("truncatetbsuccess", "changetable.php?mydbname= $dbname");
}