PHP MySQL Syntax
Fehler beim erstellen der Tabelle api_account_Characters
(Table 'api_account_characters' already exists)
In step 5 wird falls eine Tabelle schon besteht diese gelöscht, in schritt 6 sollen alle erstellt werden,
warum löscht mein script aber die eine Tabelle nicht? (die tabelle wurde mit schritt 6 vorher erstellt also ich habe nix manuel an der db geändert).
Alle anderen löscht er wie gewollt.
Danke im vorraus
Martin
warum löscht mein script aber die eine Tabelle nicht? (die tabelle wurde mit schritt 6 vorher erstellt also ich habe nix manuel an der db geändert).
Alle anderen löscht er wie gewollt.
Danke im vorraus
Martin
elseif ($step == 5){
include_once("includes/config.inc.php");
//Tabellen löschen:
$tbname = array();
$tbname = "forum_anhang";
$tbname = "forum_antworten";
$tbname = "forum_boards";
$tbname = "forum_config";
$tbname = "forum_design";
$tbname = "forum_gruppen";
$tbname = "forum_mod";
$tbname = "forum_pm";
$tbname = "forum_posts";
$tbname = "forum_rang";
$tbname = "forum_smilies";
$tbname = "forum_thread";
$tbname = "forum_umfrage";
$tbname = "forum_user";
$tbname = "forum_user2gruppen";
$tbname = "forum_useronline";
$tbname = "forum_vote";
$tbname = "api_account_Characters";
$tbname = "api_corp_AssetList";
$tbname = "api_corp_MemberTracking";
$tbname = "api_corp_StarbaseList";
$tbname = "api_corp_StarbaseDetail";
$tbname = "api_corp_Standings";
$tbname = "api_eve_AllianceList";
$tbname = "api_eve_ErrorList";
$tbname = "api_map_Sovereignty";
$tbname = "api_map_SovereigntyStatus";
$drop_tb = array();
$result = mysql_list_tables($dbname);
for($i=0;$i<mysql_num_rows($result);$i++){
if(in_array(mysql_tablename($result,$i),$tbname)){
$drop_tb = mysql_tablename($result,$i);
}
}
$text = "";
foreach($drop_tb AS $wert){
$drop = @mysql_query("DROP TABLE `$wert`");
if($drop == false) {
$text .= "Tabelle <b>$wert</b> konnte <b>nicht</b> gelöscht werden<br>";
}
}
if($text == "")
$text = "Die Tabellen wurden erfolgreich gelöscht<br>";
$text .= "<br><a href=\"?step=6\">Weiter</a>";
}
elseif ($step == 6){
include_once("includes/config.inc.php");
$exists = "";
if($extra == "exists")
$exists = "IF NOT EXISTS";
$tb_sql = array();
$tb_sql = array("CREATE TABLE $exists `forum_anhang` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`postid` int(10) unsigned NOT NULL default '0',
`pmid` varchar(100) NOT NULL default '',
`name` varchar(250) NOT NULL default '',
`endung` varchar(10) NOT NULL default '',
`size` smallint(5) NOT NULL default '0',
`counter` mediumint(8) unsigned NOT NULL default '0',
`time` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;","forum_anhang");
..........
$tb_sql = array("CREATE TABLE $exists `forum_vote` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`umfrageid` mediumint(8) unsigned NOT NULL default '0',
`userid` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;","forum_vote");
$tb_sql = array("CREATE TABLE $exists `api_account_Characters` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
`name` varchar(64) NOT NULL default '',
`characterID` int unsigned NOT NULL default '0',
`corporationName` varchar(64) NOT NULL default '',
`corporationID` int unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM;","api_account_Characters");
$tb_sql = array("CREATE TABLE $exists `api_corp_AssetList` (
`itemID` int unsigned NOT NULL,
`locationID` int unsigned NOT NULL,
`typeID` int unsigned NOT NULL,
`quantity` int unsigned NOT NULL,
`flag` int unsigned NOT NULL,
`singleton` bool NOT NULL
) TYPE=MyISAM;","api_corp_AssetList");
$text = "";
foreach($tb_sql AS $sql){
$query = @mysql_query($sql);
if($query == false)
$text .= "Fehler beim erstellen der Tabelle <b>".$sql[1]."</b><br><small>(".mysql_error().")</small><br><br>";
}
if($text == "") {
$text = "Die Tabellen wurden erfolgreich erstellt<br><br>";
}
$text .= "<a href=\"?step=7\">Weiter</a>";
} //step: 6
Please also mark the comments that contributed to the solution of the article
Content-Key: 131437
Url: https://administrator.de/contentid/131437
Printed on: April 26, 2024 at 20:04 o'clock
3 Comments
Latest comment