par
kweb » 21 sept. 2007, 11:03
Slt, comme d'habitude je reviens vers vous pour avoir un peu d'aide.
J'ai créé 2 tables :
Code : Tout sélectionner
CREATE TABLE `categorie` (
`id_categorie` int(11) NOT NULL auto_increment,
`txt_categorie` varchar(250) NOT NULL,
KEY `id_categorie` (`id_categorie`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Code : Tout sélectionner
CREATE TABLE `formation` (
`id_formation` int(11) NOT NULL auto_increment,
`id_categorie_formation` int(11) NOT NULL,
`nom_formation` varchar(250) NOT NULL,
`date_formation` date NOT NULL,
`ville_formation` varchar(250) NOT NULL,
`pays_formation` varchar(250) NOT NULL,
`publique_formation` longtext NOT NULL,
`objectif_formation` longtext NOT NULL,
`description_formation` longtext NOT NULL,
`program_formation` longtext NOT NULL,
KEY `id_formation` (`id_formation`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Dans la table formation, je récupère l'ID de la table catégorie.
Sur une des pages du site, j'affiche certaines donnée concernant la formation :
Partie de code simplifié
<?
$sql = "SELECT * FROM formation ORDER BY nom_formation";
$sql_retour = mysql_query($sql) or die (mysql_error());
while ($ligne = mysql_fetch_array($sql_retour))
{
echo $ligne['nom_formation'];
echo $ligne['date_formation'];
echo $ligne['ville_formation'];
}
?>
Je voudrais faire affiché aussi, le "txt_categorie" associé a la formation.
mais je ne vois pas comment faire
Merci par avance de votre aide
Slt, comme d'habitude je reviens vers vous pour avoir un peu d'aide.
J'ai créé 2 tables :
[code]CREATE TABLE `categorie` (
`id_categorie` int(11) NOT NULL auto_increment,
`txt_categorie` varchar(250) NOT NULL,
KEY `id_categorie` (`id_categorie`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;[/code]
[code]CREATE TABLE `formation` (
`id_formation` int(11) NOT NULL auto_increment,
`id_categorie_formation` int(11) NOT NULL,
`nom_formation` varchar(250) NOT NULL,
`date_formation` date NOT NULL,
`ville_formation` varchar(250) NOT NULL,
`pays_formation` varchar(250) NOT NULL,
`publique_formation` longtext NOT NULL,
`objectif_formation` longtext NOT NULL,
`description_formation` longtext NOT NULL,
`program_formation` longtext NOT NULL,
KEY `id_formation` (`id_formation`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;[/code]
[i]Dans la table formation, je récupère l'ID de la table catégorie.[/i]
Sur une des pages du site, j'affiche certaines donnée concernant la formation :
[i]Partie de code simplifié[/i]
[php]<?
$sql = "SELECT * FROM formation ORDER BY nom_formation";
$sql_retour = mysql_query($sql) or die (mysql_error());
while ($ligne = mysql_fetch_array($sql_retour))
{
echo $ligne['nom_formation'];
echo $ligne['date_formation'];
echo $ligne['ville_formation'];
}
?>[/php]
Je voudrais faire affiché aussi, le "txt_categorie" associé a la formation.
mais je ne vois pas comment faire :?: :?:
Merci par avance de votre aide