94 lines
2.4 KiB
PHP
Executable File
94 lines
2.4 KiB
PHP
Executable File
<?
|
||
include("mysql_compat.php");
|
||
$db=mysql_connect('o2000', 'jmevel', 'jmevel01');
|
||
|
||
$s='\'';
|
||
?>
|
||
<html>
|
||
|
||
|
||
|
||
<body background="../images/balle_raquette3.jpg">
|
||
fdsfsd
|
||
<p>
|
||
|
||
<script language="JavaScript">
|
||
function choix_category(champ) {
|
||
if(champ.selectedIndex>-1)
|
||
monform.submit()
|
||
}
|
||
function choix_article(champ) {
|
||
if(champ.selectedIndex>-1)
|
||
monform.submit()
|
||
}
|
||
</script>
|
||
|
||
<form name="monform" method="get" action="consult2.php" target="_principal">
|
||
<p>Choisissez la rubrique pour consultation : <select NAME="category_selected" ONCHANGE="choix_category(this)">
|
||
<?
|
||
$sql = "SELECT * FROM categories ORDER BY name;";
|
||
$result=mysqli_query($db, $sql);
|
||
while ($item = mysqli_fetch_array($result))
|
||
{
|
||
//if ($category_selected == NULL) {
|
||
// $category_selected = $item["name"];}
|
||
if ($item["name"] != $category_selected) {
|
||
printf("<option VALUE=\"%s\">%s", $item["name"], $item["name"]);
|
||
|
||
}
|
||
else {
|
||
printf("<option SELECTED VALUE=\"%s\">%s</option>", $item["name"], $item["name"]);
|
||
$category_selected = $item["name"];
|
||
}
|
||
}
|
||
?> </select>
|
||
</p>
|
||
<?
|
||
$sql="SELECT id FROM categories WHERE name=$s$category_selected$s";
|
||
$result=mysqli_query($db, $sql);
|
||
$item = mysqli_fetch_array($result);
|
||
$catnum=$item["id"];
|
||
$name=$category_selected;
|
||
|
||
$sql="SELECT * FROM articles where id_cat=$catnum";
|
||
$result=mysqli_query($db, $sql);
|
||
while ($item = mysqli_fetch_array($result))
|
||
{
|
||
if ($article_selected == NULL) { $article_selected = $item["sujet"];}
|
||
if ($item["sujet"] != $article_selected) { printf("<option VALUE=\"%s\">", $item["sujet"]);
|
||
}
|
||
else { printf("<option SELECTED VALUE=\"%s\"></option>", $item["sujet"]);
|
||
$art_sel=$item["id_art"];
|
||
}
|
||
}
|
||
?> </select>
|
||
</p>
|
||
|
||
|
||
|
||
</form>
|
||
<TABLE width="100%" border=1 bgcolor="#FFFFFF">
|
||
|
||
<?
|
||
$sujet=$article_selected;
|
||
$doitonce=0;
|
||
$space='width="15%"';
|
||
$result=mysqli_query($db, $sql);
|
||
while ($item = mysqli_fetch_array($result))
|
||
{
|
||
$art_sel=$item["id_art"];
|
||
if (!($doitonce)) {printf("<TR><TD><B>Sujet de l'article</TD></TR>");
|
||
}
|
||
printf("<TR><TD><A HREF=\"article2.php?name=%s&id_art=%s&sujet_art=%s\">%s</A></TD></TR>",$name, $art_sel, $item["sujet"], $item["sujet"]);
|
||
$doitonce=1;
|
||
}
|
||
if ($id == -1)
|
||
{
|
||
# reponse vide: pas d'article pour cette categorie
|
||
print "<BR>Il n'existe pas d'article concernant cette rubrique.<BR>";
|
||
print "<BR>Essayez une autre cat<61>gorie.<BR>";
|
||
}
|
||
?>
|
||
</TABLE>
|
||
|