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

PHP & Base de données Discussion :

You have an error in your SQL syntax [MySQL]


Sujet :

PHP & Base de données

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    422
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 422
    Par défaut You have an error in your SQL syntax
    Bonjour
    J'ai cette erreur dans cette création et je ne trouve pas pourquoi (ça marche en interne et pas sur le serveur externe ??)

    Erreur sql :Création table collecYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( id int(6) NOT NULL auto_increment, yvert text NOT NULL, neuf int(4) NOT NULL, ' at line 1

    version de mysql sur le serveur externe : mysql 5.1.73-1+deb6u1

    ($nomcollec est bien connu)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    		$sql='CREATE TABLE '.$nomcollec.' ( id int(6) NOT NULL auto_increment, yvert text NOT NULL, neuf int(4) NOT NULL, valneuf decimal(10,2) NOT NULL, dateaquineuf text NOT NULL, oblit int(4) NOT NULL, valoblit decimal(10,2) NOT NULL, dateaquioblit text NOT NULL, neufchar int(4) NOT NULL, valneufchar decimal(10,2) NOT NULL, dateaquineufchar text NOT NULL, photo text NOT NULL, info text NOT NULL, desig text NOT NULL, annee text NOT NULL, chemin text NOT NULL, numero text NOT NULL, type text NOT NULL, cote int(6) NOT NULL, graveur text NOT NULL, dessin text NOT NULL, couleur text NOT NULL, dentelure text NOT NULL, faciale text NOT NULL, retrait text NOT NULL, prixneuf decimal(10,2) NOT NULL, prixchar decimal(10,2) NOT NULL, prixoblit decimal(10,2) NOT NULL, impression text NOT NULL, qtemis text NOT NULL, annee_cote text NOT NULL, date datetime NOT NULL, lib14 text NOT NULL, lib15 text NOT NULL, lib16 text NOT NULL, lib17 text NOT NULL, lib18 text NOT NULL, PRIMARY KEY  (id) )DEFAULT CHARSET=utf8'; 
     
    		mysqli_query($base_collec,$sql)  or die ('Erreur sql :Création table collec'.mysqli_error($base_collec));
    Merci de vous pencher sur mon problème

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    Tu as affiché $sql pour voir ?
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  3. #3
    Membre éclairé
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    422
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 422
    Par défaut
    Merci, désolé pour les "bornes code"

    Voila ce qui s'affiche sur le serveur externe

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    create table ( id int NOT NULL auto_increment, yvert text NOT NULL, neuf int NOT NULL, valneuf decimal(10,2) NOT NULL, dateaquineuf text NOT NULL, oblit int(4) NOT NULL, valoblit decimal(10,2) NOT NULL, dateaquioblit text NOT NULL, neufchar int(4) NOT NULL, valneufchar decimal(10,2) NOT NULL, dateaquineufchar text NOT NULL, photo text NOT NULL, info text NOT NULL, desig text NOT NULL, annee text NOT NULL, chemin text NOT NULL, numero text NOT NULL, type text NOT NULL, cote int(6) NOT NULL, graveur text NOT NULL, dessin text NOT NULL, couleur text NOT NULL, dentelure text NOT NULL, faciale text NOT NULL, retrait text NOT NULL, prixneuf decimal(10,2) NOT NULL, prixchar decimal(10,2) NOT NULL, prixoblit decimal(10,2) NOT NULL, impression text NOT NULL, qtemis text NOT NULL, annee_cote text NOT NULL, date datetime NOT NULL, lib14 text NOT NULL, lib15 text NOT NULL, lib16 text NOT NULL, lib17 text NOT NULL, lib18 text NOT NULL, PRIMARY KEY (id) )DEFAULT CHARSET=utf8
     
     
    Erreur sql :Création table collecYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( id int NOT NULL auto_increment, yvert text NOT NULL, neuf int NOT NULL, valneu' at line 1

  4. #4
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Par défaut
    $nomcollec est vide comme tu le vois.
    N'oubliez pas de consulter les FAQ PHP et les cours et tutoriels PHP

  5. #5
    Membre éclairé
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    422
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 422
    Par défaut
    Merci,
    Je vais chercher pourquoi je perds cette info ...
    En interne je la récupère bien.

    Encore merci

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

Discussions similaires

  1. Réponses: 9
    Dernier message: 08/04/2015, 19h33
  2. Réponses: 4
    Dernier message: 03/09/2008, 01h44
  3. Ma requête contient une erreur, que je ne trouve pas
    Par adrien.ren dans le forum Langage SQL
    Réponses: 2
    Dernier message: 30/05/2008, 10h32
  4. Réponses: 20
    Dernier message: 08/06/2006, 10h12

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