";
}
}
function creatdb($dbname)
{
$result=mysql_create_db($dbname);
if ($result){
echo "
";
echo "
$dbname 创建成功!
";
echo "
";}
else{
echo "
";
echo "
创建失败!
";
echo "
";}
}
function dropdb($dbname)
{
$result=mysql_drop_db($dbname);
if ($result){
echo "
";
echo "
$dbname 成功删除!
";
echo "
";}
else{
echo "
";
echo "
删除失败!
";
echo "
";}
}
?>
数据库创建结果如下:
目前数据库列表如下:
";
$result=mysql_list_dbs();
showdb($result);
break;
case '删除数据库':
dropdb($DATABASENAME);
echo "
目前数据库列表如下:
";
$result=mysql_list_dbs();
showdb($result);
break;
case '创建表':
if (mysql_select_db($DATABASENAME))
{
if (mysql_db_query($DATABASENAME,"select * from $TABLENAME"))
echo "
在数据库: $DATABASENAME 中已存在 $TABLENAME 表。请检查表名称!
";
else
{
$string="CREATE TABLE ".$TABLENAME."(";
if ($TYPE[1]<>"NONE") $string=$string.$FIELDNAME[1]." ".$TYPE[1];
for($i=2;$i<=10;$i++)
{
if ($TYPE[$i]<>"NONE") $string=$string.",".$FIELDNAME[$i]." ".$TYPE[$i];
}
$string=$string.")";
$result=mysql_db_query($DATABASENAME,"$string");
if ($result)
{
echo "