Code : Tout sélectionner
CREATE TABLE `chds_cours_horraire` (
`ID` tinyint(11) NOT NULL default '0',
`ID_date` tinyint(11) NOT NULL auto_increment,
`cours_date` varchar(44) NOT NULL default '0000-00-00',
PRIMARY KEY (`ID_date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
Code : Tout sélectionner
CREATE TABLE `chds_cours_desc` (
`ID` tinyint(11) NOT NULL auto_increment,
`nom_prof` varchar(50) NOT NULL default '',
`nationnalite_prof` varchar(50) NOT NULL default '',
`commentaire_prof` text NOT NULL,
`DateFR` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=82 ; Code : Tout sélectionner
INSERT INTO chds_cours_horraire VALUES (82,'','ghggh','ghghghg','hghghgh')
Code : Tout sélectionner
INSERT INTO table( champ1, champ2 )VALUES ( 1, 'truc' ) , ( 2, 'machin' ) , ( 3, 'bidule' ) $values="";
//construction dynamique de la requete
for($i=1;$i<=$nb;$i++)
{
$values .= "(".$id.",'".$_POST['champ'.$i]."'),";
}
$sql="INSERT INTO chds_cours_horraire (ID,cours_date) VALUES ".$values;
$sql = substr($sql, 0, -1); //enleve la dernière virgule
avant d'exécuter affiche la requete générée et verifis qu'elle est conforme.