Une faute dans mon script aider moi svp
Résolu
zed23000
Messages postés
23
Date d'inscription
Statut
Membre
Dernière intervention
-
zed23000 Messages postés 23 Date d'inscription Statut Membre Dernière intervention -
zed23000 Messages postés 23 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
j'ai un script php pour creer une ptite base de donner a partir d'une autre base
mais la je beug un peut tt va bien mais la creation de la base ne se fait pas bien
1- la table candidat je la trouve creer avec tout les champ mais vide
voila mon script aider moi svp
j'ai un script php pour creer une ptite base de donner a partir d'une autre base
mais la je beug un peut tt va bien mais la creation de la base ne se fait pas bien
1- la table candidat je la trouve creer avec tout les champ mais vide
voila mon script aider moi svp
<?php include('../conex/conex.php');include('../ct.php'); mysql_select_db($labase,$connexionidysc) or die ("connexion impossible base"); $ex=$_GET["ex"];$w=$_GET["w"]; if ($ex==3) {$base="bac_eps_".$w;$c="bac_candidat_2017";$et="bac_etab_2017";$ser="series";} else if ($ex==2) {$base="bem_epsdm_".$w;$c="bem_candidat_2017";$et="bem_etab_2017";} $cand=$base.".candidat"; $cor=$base.".cor"; $ccg=$base.".cg"; $client=$base.".clients"; $etab=$base.".etab"; $series=$base.".series"; $matiere=$base.".matiere"; $tex=$base.".ex"; $eps=$base.".eps" ; $tdes=$base.".des" ; $tmus=$base.".mus" ; $cre=mysql_query("CREATE DATABASE $base "); $crs=mysql_query("DROP TABLE IF EXISTS $cand") or die("crcand"); $crs=mysql_query("DROP TABLE IF EXISTS $client") or die("crcli"); $crs=mysql_query("DROP TABLE IF EXISTS $etab") or die("cretab"); $crs=mysql_query("DROP TABLE IF EXISTS $tex") or die("cr"); //clinet $cre=mysql_query(" CREATE TABLE $client ( `num` int( 4 ) NOT NULL AUTO_INCREMENT , `user` varchar( 20 ) NOT NULL , `ip` varchar( 19 ) NOT NULL , `c1` tinyint( 1 ) NOT NULL DEFAULT '1', `c2` tinyint( 1 ) NOT NULL DEFAULT '1', `c3` tinyint( 1 ) NOT NULL DEFAULT '1', `c4` tinyint( 1 ) NOT NULL DEFAULT '1', `c5` tinyint( 1 ) NOT NULL DEFAULT '1', PRIMARY KEY ( `num` ) ) ENGINE = MyISAM DEFAULT CHARSET = latin1;"); $ins=mysql_query("INSERT INTO $client (`num`, `user`, `ip`, `c1`, `c2`, `c3`, `c4`, `c5`) VALUES (1, '', '127.0.0.1', 1, 1, 1, 1, 1 ), (2, '', '127.0.0.1', 1, 1, 1, 1, 1), (3, '', '127.0.0.1', 1, 1, 1, 1, 1), (4, '', '127.0.0.1', 1, 1, 1, 1, 1), (5, '', '127.0.0.1', 1, 1, 1, 1, 1), (6, '', '127.0.0.1', 1, 1, 1, 1, 1), (7, '', '127.0.0.1', 1, 1, 1, 1, 1), (8, '', '127.0.0.1', 1, 1, 1, 1, 1), (9, '', '127.0.0.1', 1, 1, 1, 1, 1), (10, '', '127.0.0.1', 1, 1, 1, 1, 1), (11, '', '127.0.0.1', 1, 1, 1, 1, 1), (12, '', '127.0.0.1', 1, 1, 1, 1, 1);"); //typeex $cre=mysql_query("CREATE TABLE $tex (`ex` int( 1 ) NOT NULL DEFAULT '1') ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin;"); $ins=mysql_query("insert into $tex VALUES('$ex');") or die("pb tex"); //cg //cor //etab $cre=mysql_query(" CREATE TABLE $etab ( `cd_etab` int( 6 ) unsigned NOT NULL , `desi` varbinary( 200 ) NOT NULL , `type` tinyint( 1 ) unsigned NOT NULL , `cd_wil` tinyint( 1 ) NOT NULL , `cd_orec` tinyint( 1 ) unsigned NOT NULL , `cd_secteur` int( 5 ) NOT NULL , PRIMARY KEY ( `cd_etab` ) ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin;"); $ins=mysql_query("insert into $etab select `cd_etab` , `desi` , `type` , `cd_wil` , `cd_orec` , `cd_secteur` from $labase.$et where cd_wil=$w order by cd_secteur,cd_etab") or die("pb etab"); //exam if ($ex==3) { $crs=mysql_query("DROP TABLE IF EXISTS $series") or die("crser"); $crs=mysql_query("DROP TABLE IF EXISTS $eps") or die("creps"); //cand $cre=mysql_query(" CREATE TABLE $cand ( `num` int( 11 ) NOT NULL AUTO_INCREMENT , `numero` int( 11 ) DEFAULT NULL , `numord` int( 11 ) DEFAULT NULL , `cd_wil` tinyint( 1 ) unsigned NOT NULL , `cd_etab` int( 4 ) unsigned zerofill NOT NULL , `cd_serie` tinyint( 1 ) NOT NULL , `cd_lg3` tinyint( 1 ) DEFAULT NULL , `amz` tinyint( 1 ) DEFAULT '0', `type` tinyint( 1 ) NOT NULL DEFAULT '1', `spec` tinyint( 1 ) NOT NULL DEFAULT '1', `nb_cand` tinyint( 1 ) NOT NULL DEFAULT '0', `dbl` tinyint( 1 ) NOT NULL DEFAULT '0', `nbc` tinyint( 1 ) NOT NULL DEFAULT '1', `dispense` tinyint( 1 ) NOT NULL DEFAULT '1', `nom` varbinary( 80 ) NOT NULL , `prenom` varbinary( 80 ) NOT NULL , `date_jour` tinyint( 1 ) unsigned NOT NULL DEFAULT '0', `date_mois` tinyint( 1 ) unsigned NOT NULL DEFAULT '0', `date_annee` smallint( 1 ) unsigned NOT NULL , `vilnais` varbinary( 80 ) NOT NULL , `vilnaisb` int( 4 ) unsigned NOT NULL , `wilnais` tinyint( 1 ) unsigned NOT NULL , `nation` tinyint( 1 ) NOT NULL DEFAULT '1', `pays` varbinary( 80 ) DEFAULT NULL , `sexe` tinyint( 1 ) NOT NULL DEFAULT '1', `nomf` varchar( 40 ) COLLATE utf8_bin NOT NULL , `prenomf` varchar( 40 ) COLLATE utf8_bin NOT NULL , `prenom_pere` varbinary( 80 ) NOT NULL , `nom_mere` varbinary( 80 ) NOT NULL , `prenom_mere` varbinary( 80 ) NOT NULL , `adresse` varbinary( 80 ) NOT NULL , `adrb` int( 4 ) unsigned NOT NULL , `adrw` tinyint( 1 ) unsigned NOT NULL , `telephone` int( 10 ) unsigned zerofill DEFAULT NULL , `email` varchar( 60 ) COLLATE utf8_bin DEFAULT NULL , `usec` varchar( 20 ) CHARACTER SET latin1 NOT NULL , `pwd` int( 4 ) NOT NULL , `din` int( 10 ) unsigned NOT NULL , `cd_orec` tinyint( 1 ) DEFAULT NULL , `cd_secteur` int( 3 ) DEFAULT NULL , `handicap` tinyint( 1 ) DEFAULT '0', `cat` tinyint( 1 ) DEFAULT NULL , `cd_examen` int( 6 ) unsigned DEFAULT NULL , `juryel` int( 6 ) unsigned DEFAULT NULL , `matricule` int( 8 ) unsigned DEFAULT NULL , `codemdn` int( 10 ) unsigned DEFAULT NULL , `codeesi` char( 8 ) COLLATE utf8_bin DEFAULT NULL , PRIMARY KEY ( `num` ) , KEY `mat` ( `matricule` ) , KEY `juryel` ( `juryel` ) ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin; ") or die("cand"); $ins=mysql_query("insert into $cand select `num` , `numero` , `numord` , `cd_wil` , `cd_etab` , `cd_serie` , `cd_lg3` , `amz` , `type` , `spec` , `nb_cand` , `dbl` , `nbc` , `dispense` , trim(`nom`) , trim(`prenom`) , `date_jour` , `date_mois` , `date_annee` , trim(`vilnais`) , `vilnaisb` , `wilnais` , `nation` , trim(`pays`) , `sexe` , trim(`nomf`) , trim(`prenomf`) , trim(`prenom_pere`) , trim(`nom_mere`) , trim(`prenom_mere`), trim(`adresse`) , `adrb` , `adrw` , `telephone` , `email` , `usec` , `pwd` , `din` , `cd_orec` , `cd_secteur` , `handicap` , `cat` , `cd_examen` , `juryel` , `matricule` , `codemdn` , `codeesi` from $labase.$c where cd_wil=$w")or die("candins"); $alt=mysql_query("alter table $cand add `eps` float DEFAULT NULL ") or die("candalt"); //eps $cre=mysql_query(" CREATE TABLE $eps ( `cd_wil` tinyint( 1 ) NOT NULL , `cd_etab` int( 4 ) NOT NULL , `cd_serie` tinyint( 1 ) NOT NULL , `sexe` tinyint( 1 ) NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET = latin1;"); $ins=mysql_query("insert into $eps select cd_wil,cd_etab,cd_serie,sexe from $cand group by cd_wil,cd_etab,cd_serie,sexe"); $alt=mysql_query("ALTER TABLE $eps ADD `num` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST "); $alt=mysql_query("alter table $eps add `ok` tinyint( 1 ) NOT NULL , add `ip` varbinary( 30 ) NOT NULL ") or die("epsalt"); //serie $cre=mysql_query(" CREATE TABLE $series ( `cd_serie` smallint( 1 ) NOT NULL , `desi` varbinary( 100 ) NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET = latin1; "); $ins=mysql_query("insert into $series select `cd_serie` , `desi` from $labase.$ser"); } else if ($ex==2) { $crs=mysql_query("DROP TABLE IF EXISTS $eps") or die("creps"); $crs=mysql_query("DROP TABLE IF EXISTS $tdes") or die("crdes"); $crs=mysql_query("DROP TABLE IF EXISTS $tmus") or die("crmus"); $cre=mysql_query(" CREATE TABLE $cand ( `Num` int( 11 ) NOT NULL AUTO_INCREMENT , `numero` int( 11 ) NOT NULL , `usec` varchar( 20 ) CHARACTER SET latin1 NOT NULL , `cd_wil` tinyint( 1 ) unsigned NOT NULL , `cd_orec` tinyint( 1 ) unsigned NOT NULL , `cd_etab` int( 5 ) unsigned NOT NULL , `cd_secteur` smallint( 4 ) unsigned NOT NULL , `type` tinyint( 1 ) unsigned NOT NULL , `amz` tinyint( 1 ) unsigned DEFAULT '0', `dispense` tinyint( 1 ) unsigned NOT NULL DEFAULT '1', `music` tinyint( 1 ) unsigned NOT NULL , `dessin` tinyint( 1 ) unsigned NOT NULL , `nom` varbinary( 80 ) NOT NULL , `prenom` varbinary( 80 ) NOT NULL , `date_jour` tinyint( 1 ) unsigned NOT NULL DEFAULT '0', `date_mois` tinyint( 1 ) unsigned NOT NULL DEFAULT '0', `date_annee` smallint( 4 ) unsigned NOT NULL , `vilnais` varbinary( 80 ) NOT NULL , `wilnais` tinyint( 1 ) unsigned NOT NULL , `nation` tinyint( 1 ) unsigned NOT NULL DEFAULT '1', `pays` varbinary( 80 ) NOT NULL , `sexe` tinyint( 1 ) unsigned NOT NULL DEFAULT '1', `telephone` int( 10 ) NOT NULL , `email` varbinary( 120 ) NOT NULL , `pwd` int( 4 ) NOT NULL , `din` int( 10 ) unsigned NOT NULL , `adresse` varbinary( 200 ) NOT NULL , `numord` int( 11 ) NOT NULL , `handicap` tinyint( 1 ) DEFAULT '0', `cat` tinyint( 1 ) DEFAULT NULL , `cd_examen` int( 6 ) unsigned DEFAULT NULL , `juryel` int( 6 ) unsigned DEFAULT NULL , `matricule` int( 8 ) unsigned DEFAULT NULL , PRIMARY KEY ( `Num` ) , KEY `mat` ( `matricule` ) , KEY `juryel` ( `juryel` ) ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_bin;"); $ins=mysql_query("insert into $cand select `Num` , `numero` , `usec` , `cd_wil` , `cd_orec` , `cd_etab` , `cd_secteur` , `type` , `amz` , `dispense` , `music` , `dessin` , trim(`nom`) , trim(`prenom`) , `date_jour`, `date_mois` , `date_annee` , trim(`vilnais`) , `wilnais` , `nation` , `pays` , `sexe` , `telephone` , `email` , `pwd` , `din` , trim(`adresse`) , `numord` , `handicap` , `cat` , `cd_examen` , `juryel` , `matricule` from $labase.$c where cd_wil=$w")or die("candins"); $alt=mysql_query("alter table $cand add `eps` float DEFAULT NULL , add `mus` float DEFAULT NULL , add `des` float DEFAULT NULL ") or die("candalt"); //eps $cre=mysql_query(" CREATE TABLE $eps ( `cd_wil` tinyint( 1 ) NOT NULL , `cd_etab` int( 6 ) NOT NULL , `sexe` tinyint( 1 ) NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET = latin1;"); $ins=mysql_query("insert into $eps select cd_wil,cd_etab,sexe from $cand group by cd_wil,cd_etab,sexe"); $alt=mysql_query("ALTER TABLE $eps ADD `num` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST "); $alt=mysql_query("alter table $eps add `ok` tinyint( 1 ) NOT NULL , add `ip` varbinary( 30 ) NOT NULL ") or die("epsalt"); //des $cre=mysql_query(" CREATE TABLE $tdes ( `cd_wil` tinyint( 1 ) NOT NULL , `cd_etab` int( 6 ) NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET = latin1;"); $ins=mysql_query("insert into $tdes select cd_wil,cd_etab from $cand group by cd_wil,cd_etab"); $alt=mysql_query("ALTER TABLE $tdes ADD `num` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST "); $alt=mysql_query("alter table $tdes add `ok` tinyint( 1 ) NOT NULL , add `ip` varbinary( 30 ) NOT NULL ") or die("dessalt"); //mus $cre=mysql_query(" CREATE TABLE $tmus ( `cd_wil` tinyint( 1 ) NOT NULL , `cd_etab` int( 6 ) NOT NULL ) ENGINE = MyISAM DEFAULT CHARSET = latin1;"); $ins=mysql_query("insert into $tmus select cd_wil,cd_etab from $cand group by cd_wil,cd_etab"); $alt=mysql_query("ALTER TABLE $tmus ADD `num` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST "); $alt=mysql_query("alter table $tmus add `ok` tinyint( 1 ) NOT NULL , add `ip` varbinary( 30 ) NOT NULL ") or die("musalt"); } //echo "fin" ; mysql_close(); ?>
A voir également:
- Une faute dans mon script aider moi svp
- Script vidéo youtube - Guide
- Mas script - Accueil - Windows
- Ghost script - Télécharger - Polices de caractères
- Script cmd - Guide
- Correcteur de faute - Guide
1 réponse
Bonjour,
1 - A l'avenir, merci d'utiliser les BALISES DE CODE (la coloration syntaxique) pour poster ton code sur le forum.
2 - Ton souci vient donc de :
As tu essayé de faire un ECHO de cette requête (histoire de voir ce qui est réellement envoyé une fois les "variables" remplacées par leurs valeurs..) puis de la tester EN DIRECT dans ta bdd (via phpmyadmin par exemple )
1 - A l'avenir, merci d'utiliser les BALISES DE CODE (la coloration syntaxique) pour poster ton code sur le forum.
2 - Ton souci vient donc de :
$ins=mysql_query("insert into $cand select `num` , `numero` , `numord` , `cd_wil` , `cd_etab` , `cd_serie` , `cd_lg3` , `amz` , `type` , `spec` , `nb_cand` , `dbl` , `nbc` , `dispense` , trim(`nom`) , trim(`prenom`) , `date_jour` , `date_mois` , `date_annee` , trim(`vilnais`) , `vilnaisb` , `wilnais` , `nation` , trim(`pays`) , `sexe` , trim(`nomf`) , trim(`prenomf`) , trim(`prenom_pere`) , trim(`nom_mere`) , trim(`prenom_mere`), trim(`adresse`) , `adrb` , `adrw` , `telephone` , `email` , `usec` , `pwd` , `din` , `cd_orec` , `cd_secteur` , `handicap` , `cat` , `cd_examen` , `juryel` , `matricule` , `codemdn` , `codeesi` from $labase.$c where cd_wil=$w")or die("candins");
As tu essayé de faire un ECHO de cette requête (histoire de voir ce qui est réellement envoyé une fois les "variables" remplacées par leurs valeurs..) puis de la tester EN DIRECT dans ta bdd (via phpmyadmin par exemple )
nn j'ai pas esseyer de mettre un echo
je le met ou exactement svp merci
les 2 dernier champ il doivent pa etre la
merci