Probleme table sql



  • Bonjour, bonne année, bonne santé,

    Alors voici mon probleme:
    Je vais dans phpmyadmin, je vais dans l'onglet sql puis je colle ma table et la :

    Erreur
    
    requête SQL:
    
    CREATE TABLE $options_table(
    home varchar( 50 ) NOT NULL default '',
    sitetitle varchar( 150 ) NOT NULL default '',
    adminemail varchar( 50 ) NOT NULL default '',
    username varchar( 50 ) NOT NULL default '',
    PASSWORD varchar( 50 ) NOT NULL default '',
    domainip varchar( 15 ) NOT NULL default '',
    maindomain varchar( 50 ) NOT NULL default '',
    mailtoadmin char( 3 ) NOT NULL default '',
    language varchar( 20 ) NOT NULL default '',
    multiple char( 3 ) NOT NULL default '',
    minlength char( 2 ) NOT NULL default '',
    maxlength char( 2 ) NOT NULL default '',
    reserved text NOT NULL ,
    forbidden text NOT NULL ,
    autoappr char( 3 ) NOT NULL default '',
    theme varchar( 50 ) NOT NULL default '',
    release varchar( 10 ) NOT NULL default ''
    )
    
    MySQL a répondu:Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'release varchar(10) NOT NULL default '' )' at line 1 
    


  • essaye déjà de mettre un point virgule a la fin de ton ta commande :

    CREATE TABLE ...
    ...........
    release varchar( 10 ) NOT NULL default '' 
    );
    
    

    Mais je doute que ça marche, je te conseil d'ajouter ta table ainsi:

    CREATE TABLE `$options_table` (
      `home` varchar(50) NOT NULL default '',
      `sitetitle` varchar( 150 ) NOT NULL default '', 
    
       etc.........................
    
      PRIMARY KEY  (`home`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
    
    


  • sa fonctionne pas pour aucun des deux!

    Erreur
    
    requête SQL:
    
    CREATE TABLE $options_table(
    `home` varchar( 50 ) NOT NULL default '',
    `sitetitle` varchar( 150 ) NOT NULL default '',
    `adminemail` varchar( 50 ) NOT NULL default '',
    `username` varchar( 50 ) NOT NULL default '',
    `PASSWORD` varchar( 50 ) NOT NULL default '',
    `domainip` varchar( 15 ) NOT NULL default '',
    `maindomain` varchar( 50 ) NOT NULL default '',
    `mailtoadmin` char( 3 ) NOT NULL default '',
    `language` varchar( 20 ) NOT NULL default '',
    `multiple` char( 3 ) NOT NULL default '',
    `minlength` char( 2 ) NOT NULL default '',
    `maxlength` char( 2 ) NOT NULL default '',
    `reserved` text NOT NULL ,
    `forbidden` text NOT NULL ,
    `autoappr` char( 3 ) NOT NULL default '',
    `theme` varchar( 50 ) NOT NULL default '',
    `release` varchar( 10 ) NOT NULL default '' PRIMARY KEY ( `home` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1;
    
    MySQL a répondu:Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( `home` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1' at line 19 
    


  • Voila j'ai trouvé!

    CREATE TABLE $options_table(
    `home` varchar( 50 ) NOT NULL default '',
    `sitetitle` varchar( 150 ) NOT NULL default '',
    `adminemail` varchar( 50 ) NOT NULL default '',
    `username` varchar( 50 ) NOT NULL default '',
    `PASSWORD` varchar( 50 ) NOT NULL default '',
    `domainip` varchar( 15 ) NOT NULL default '',
    `maindomain` varchar( 50 ) NOT NULL default '',
    `mailtoadmin` char( 3 ) NOT NULL default '',
    `language` varchar( 20 ) NOT NULL default '',
    `multiple` char( 3 ) NOT NULL default '',
    `minlength` char( 2 ) NOT NULL default '',
    `maxlength` char( 2 ) NOT NULL default '',
    `reserved` text NOT NULL ,
    `forbidden` text NOT NULL ,
    `autoappr` char( 3 ) NOT NULL default '',
    `theme` varchar( 50 ) NOT NULL default '',
    `release` varchar( 10 ) NOT NULL default '',
    PRIMARY KEY ( `home` )
    ) ENGINE = MYISAM DEFAULT CHARSET = latin1;
    ```Tu avais juste oublié une virgule
    

    release varchar( 10 ) NOT NULL default '',



  • ou alors t'aurais ecrit cette ligne comme ca :

    `home` varchar( 50 ) NOT NULL default '' PRIMARY KEY,
    
    ```et enlevé ca
    PRIMARY KEY ( `home` )


  • Ca reviens au même non ^^ ?



  • ca fait plus "clean" puis ca permet d'économiser une ligne….
    *sort :roll: :lol: *



  • heu c'est encore moi avec un new probleme:

    Erreur
    
    requête SQL:
    
    INSERT INTO $options_table( 'home', 'sitetitle', 'adminemail', 'username', 'password', 'domainip', 'maindomain', 'mailtoadmin', 'language', 'multiple', 'minlength', 'maxlength', 'reserved', 'forbidden', 'autoappr', 'theme', 'release' )
    VALUES (
    '$con_startpage', '$con_pagetitle', '$con_adminmail', '$con_adminusername', '$con_adminpass1', '$con_domainip', '$con_maindomain', '$con_mailtoadmin', '$con_language', '$con_multiple', '$con_minlength', '$con_maxlength', '$con_reserved', '$con_forbidden', '$con_autoappr', '$con_theme', '1.4',
    PRIMARY KEY ( `home` )
    )
    ENGINE =
    MYISAM DEFAULT
    CHARSET = latin1;
    
    MySQL a répondu:Documentation
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''home', 'sitetitle', 'adminemail', 'username', 'password', 'domainip', 'maindoma' at line 1 
    


  • Il te mélangedu sql et du php :?
    Tu as la ligne de code qui exécute ça?



  • ben enfaite c'est lors d'une installation d'un script sa me dit sa! pour info le code original c'est ca:```
    INSERT INTO $options_table (home, sitetitle, adminemail, username, password, domainip, maindomain, mailtoadmin, language, multiple, minlength, maxlength, reserved, forbidden, autoappr, theme, release) VALUES ('$con_startpage', '$con_pagetitle', '$con_adminmail', '$con_adminusername', '$con_adminpass1', '$con_domainip', '$con_maindomain', '$con_mailtoadmin', '$con_language', '$con_multiple', '$con_minlength', '$con_maxlength', '$con_reserved', '$con_forbidden', '$con_autoappr', '$con_theme', '1.4')



  • replace la ligne (y compris mysql_query) par:

    mysql_query("INSERT INTO ".$options_table." (home, sitetitle, adminemail, username, password, domainip, maindomain, mailtoadmin, language, multiple, minlength, maxlength, reserved, forbidden, autoappr, theme, release) VALUES ('".$con_startpage."', '".$con_pagetitle."', '".$con_adminmail."', '".$con_adminusername."', '".$con_adminpass1."', '".$con_domainip."', '".$con_maindomain."', '".$con_mailtoadmin."', '".$con_language."', '".$con_multiple."', '".$con_minlength."', '".$con_maxlength."', '".$con_reserved."', '".$con_forbidden."', '".$con_autoappr."', '".$con_theme."', '1.4')");
    


  • }
    if ($error1 || $error2  || $error2a || $error3 || $error4 || $error5 || $error6  || $error7  || $error8  || $error9) {
    	$do = "three";
    }
    // If no error occured, lets write the data into the database
    else {
    $con_adminpass1 = md5($con_adminpass1);
    mysql_connect("$mysql_host","$mysql_username","$mysql_passwd") or die (mysql_error()); 
    mysql_select_db("$mysql_dbase") or die (mysql_error());
    mysql_query("INSERT INTO ".$options_table." (home, sitetitle, adminemail, username, password, domainip, maindomain, mailtoadmin, language, multiple, minlength, maxlength, reserved, forbidden, autoappr, theme, release) VALUES ('".$con_startpage."', '".$con_pagetitle."', '".$con_adminmail."', '".$con_adminusername."', '".$con_adminpass1."', '".$con_domainip."', '".$con_maindomain."', '".$con_mailtoadmin."', '".$con_language."', '".$con_multiple."', '".$con_minlength."', '".$con_maxlength."', '".$con_reserved."', '".$con_forbidden."', '".$con_autoappr."', '".$con_theme."', '1.4')"); or die (mysql_error());
    
    // Show a success page
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <html>
    <head>
    

Se connecter pour répondre
 

Il semble que votre connexion ait été perdue, veuillez patienter pendant que nous vous re-connectons.