s7mahess
Goto Top

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

  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&ouml;scht werden<br>";  
      }
    }

    if($text == "")  
      $text = "Die Tabellen wurden erfolgreich gel&ouml;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

Content-ID: 131437

Url: https://administrator.de/contentid/131437

Ausgedruckt am: 22.11.2024 um 12:11 Uhr

maretz
maretz 10.12.2009 um 16:55:50 Uhr
Goto Top
[trommelwirbel]

und die fehlermeldung lautet....

[trommelwirbel endet]

wenn du diesen satz beenden kannst bekommst du nen bonuspunkt!
s7mahess
s7mahess 10.12.2009 um 16:58:54 Uhr
Goto Top
Fehler beim erstellen der Tabelle api_account_Characters
(Table 'api_account_characters' already exists)

steht ganz oben face-smile
s7mahess
s7mahess 10.12.2009 um 17:29:57 Uhr
Goto Top
Fehler gefunden:

api_corp_AssetList

in der datenbank steht det als

api_corp_assetlist

und damit findet

$drop = @mysql_query("DROP TABLE `$wert`"); die tabelle net