IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Requêtes MySQL Discussion :

besoin d'aide sur un fichier sql


Sujet :

Requêtes MySQL

  1. #1
    Membre à l'essai
    Inscrit en
    Août 2008
    Messages
    23
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 23
    Points : 17
    Points
    17
    Par défaut besoin d'aide sur un fichier sql
    Bonjour à tous !

    j'ai besoin d'un petit coup de main j'ai téléchargé un script php a l'intérieur duquel il y a un fichier sql pour créer mes tables mais apparemment il y a une erreur n'y connaissant rien en sql est-ce que quelqu'un pourrait me filer un coup de main ? ;-))

    voila mon fichier

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    /*  ------- MySQL ------
     *  If you desire to use MySQL to store the login / password
     *  combinations, I suggest you use a database with the following
     *  structure. Note however that you can also use other database, table
     *  and column names. They can be changed in the configuration file.
     *
     *  MySQL-Dump
     *  Database: phpSecurePages
     *  Table structure for table 'phpSP_users'
     */
     
    CREATE TABLE phpSP_users (
       primary_key MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
       user VARCHAR(50) NOT NULL,
       password VARCHAR(32) NOT NULL,
       userlevel TINYINT(3),
       PRIMARY KEY (primary_key),
       KEY (user)
    );
     
     
    /*  ---- PHP3 ---
     *  If you use phpSecurePages on a server with PHP3, the following two
     *  tables MUST be created. These two tables are not used with PHP4.
     *  The above table remains optional. Unlike the above table, only
     *  database and tables names can be changed (not column names).
     *
     *  MySQL-Dump
     *  Database : phpSecurePages
     *  Table structure for tables 'phpSP_sessions' and 'phpSP_sessionVars'
     */
     
    CREATE TABLE phpSP_sessions (
       id CHAR(20) NOT NULL,
       LastAction DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
       ip CHAR(15) NOT NULL,
       userID MEDIUMINT(9),
       PRIMARY KEY (id),
       KEY id (id),
       UNIQUE id_2 (id)
    );
     
    CREATE TABLE phpSP_sessionVars (
       id MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT,
       session VARCHAR(20) NOT NULL,
       name VARCHAR(32) NOT NULL,
       intval INT(10) UNSIGNED,
       strval VARCHAR(100),
       PRIMARY KEY (id),
       KEY sessionID (session),
       UNIQUE id (id)
    );

    je tourne avec php version 5.2.6 mysql 5.0.51b

    voila merci de votre aide

  2. #2
    Expert confirmé

    Homme Profil pro
    SDE
    Inscrit en
    Août 2007
    Messages
    2 013
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : SDE

    Informations forums :
    Inscription : Août 2007
    Messages : 2 013
    Points : 4 324
    Points
    4 324
    Par défaut
    Bonjour,

    Voici la version corrigé :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    /*  ---- PHP3 ---
     *  If you use phpSecurePages on a server with PHP3, the following two
     *  tables MUST be created. These two tables are not used with PHP4.
     *  The above table remains optional. Unlike the above table, only
     *  database and tables names can be changed (not column names).
     *
     *  MySQL-Dump
     *  Database : phpSecurePages
     *  Table structure for tables 'phpSP_sessions' and 'phpSP_sessionVars'
     */
     
    CREATE TABLE phpSP_sessions (
       id CHAR(20) NOT NULL,
       LastAction DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
       ip CHAR(15) NOT NULL,
       userID MEDIUMINT(9),
       PRIMARY KEY (id),
       KEY id (id),
       UNIQUE id_2 (id)
    );
     
    CREATE TABLE phpSP_sessionVars (
       id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
       session VARCHAR(20) NOT NULL,
       name VARCHAR(32) NOT NULL,
       intval INT(10) UNSIGNED,
       strval VARCHAR(100),
       PRIMARY KEY (id),
       KEY sessionID (session),
       UNIQUE id (id)
    );
    Le problème venais du fait qu'il n'est pas autorisé de donner une valeur par défaut à un champ anto-incrémenté.
    http://alaindefrance.wordpress.com
    Certifications : SCJP6 - SCWCD5 - SCBCD5 - SCMAD1
    SDE at BitTitan

  3. #3
    Membre à l'essai
    Inscrit en
    Août 2008
    Messages
    23
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 23
    Points : 17
    Points
    17
    Par défaut
    merci beaucoup je viens de tester et j'ai la même erreur a savoir :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    Erreur
    requête SQL: 
     
    CREATE TABLE phpSP_sessionVars(
     
    id MEDIUMINT( 8 ) UNSIGNED DEFAULT '0' NOT NULL AUTO_INCREMENT ,
    SESSION VARCHAR( 20 ) NOT NULL ,
    name VARCHAR( 32 ) NOT NULL ,
    intval INT( 10 ) UNSIGNED,
    strval VARCHAR( 100 ) ,
    PRIMARY KEY ( id ) ,
    KEY sessionID( SESSION ) ,
    UNIQUE id( id ) 
    );
     
     
     
    MySQL a répondu: 
     
    #1067 - Invalid default value for 'id'
    merci quand meme

  4. #4
    Expert confirmé

    Homme Profil pro
    SDE
    Inscrit en
    Août 2007
    Messages
    2 013
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 36
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : SDE

    Informations forums :
    Inscription : Août 2007
    Messages : 2 013
    Points : 4 324
    Points
    4 324
    Par défaut
    Arf, j'ai oublier une partie du code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    /*  ------- MySQL ------
     *  If you desire to use MySQL to store the login / password
     *  combinations, I suggest you use a database with the following
     *  structure. Note however that you can also use other database, table
     *  and column names. They can be changed in the configuration file.
     *
     *  MySQL-Dump
     *  Database: phpSecurePages
     *  Table structure for table 'phpSP_users'
     */
     
    CREATE TABLE phpSP_users (
       primary_key MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
       user VARCHAR(50) NOT NULL,
       password VARCHAR(32) NOT NULL,
       userlevel TINYINT(3),
       PRIMARY KEY (primary_key),
       KEY (user)
    );
     
     
    /*  ---- PHP3 ---
     *  If you use phpSecurePages on a server with PHP3, the following two
     *  tables MUST be created. These two tables are not used with PHP4.
     *  The above table remains optional. Unlike the above table, only
     *  database and tables names can be changed (not column names).
     *
     *  MySQL-Dump
     *  Database : phpSecurePages
     *  Table structure for tables 'phpSP_sessions' and 'phpSP_sessionVars'
     */
     
    CREATE TABLE phpSP_sessions (
       id CHAR(20) NOT NULL,
       LastAction DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
       ip CHAR(15) NOT NULL,
       userID MEDIUMINT(9),
       PRIMARY KEY (id),
       KEY id (id),
       UNIQUE id_2 (id)
    );
     
    CREATE TABLE phpSP_sessionVars (
       id MEDIUMINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
       session VARCHAR(20) NOT NULL,
       name VARCHAR(32) NOT NULL,
       intval INT(10) UNSIGNED,
       strval VARCHAR(100),
       PRIMARY KEY (id),
       KEY sessionID (session),
       UNIQUE id (id)
    );
    Requête testée.
    http://alaindefrance.wordpress.com
    Certifications : SCJP6 - SCWCD5 - SCBCD5 - SCMAD1
    SDE at BitTitan

  5. #5
    Membre à l'essai
    Inscrit en
    Août 2008
    Messages
    23
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 23
    Points : 17
    Points
    17
    Par défaut
    merci beaucoup fonctionne nickel !

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. besoin d'aide sur les fichiers
    Par lenetfm dans le forum Entrée/Sortie
    Réponses: 3
    Dernier message: 22/03/2008, 11h02
  2. besoin d'aide sur programme en sql 3
    Par abdel54 dans le forum Langage SQL
    Réponses: 2
    Dernier message: 02/12/2005, 09h19
  3. Besoin d'aide sur un script SQL de recherche
    Par agougeon dans le forum Langage SQL
    Réponses: 5
    Dernier message: 26/10/2005, 11h40
  4. besoin d'aide sur une requette sql
    Par maxidoove dans le forum Langage SQL
    Réponses: 13
    Dernier message: 10/10/2005, 18h42
  5. [intermedia] besoin d'aide sur script PL/SQL
    Par SteelBox dans le forum PL/SQL
    Réponses: 8
    Dernier message: 05/01/2004, 19h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo