107 lines
2.7 KiB
PHP
Executable File
107 lines
2.7 KiB
PHP
Executable File
<?
|
|
include("mysql_compat.php");
|
|
$db=mysql_connect('o2000', 'jmevel', 'jmevel01');
|
|
mysql_select_db("tournois_tennis_v2", $db);
|
|
$s='\'';
|
|
#$cateory_selected='MYSQL';
|
|
?>
|
|
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="fr">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
<title>pour consulter la base</title>
|
|
</head>
|
|
|
|
<body background="../images/balle_raquette3.jpg">
|
|
|
|
<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="faq/consult3.php" target="_principal">
|
|
<p>Choisissez la rubrique : <select NAME="category_selected" ONCHANGE="choix_category(this)">
|
|
<?
|
|
include("mysql_compat.php");
|
|
$sql = "SELECT * FROM categories ORDER BY name;";
|
|
$result=mysql_query($sql,$db);
|
|
while ($item = mysql_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>
|
|
<?
|
|
include("mysql_compat.php");
|
|
//$selection = $_GET["category_selected"];
|
|
//echo $selection;
|
|
$sql="SELECT id FROM categories WHERE name=$s$category_selected$s";
|
|
$result=mysql_query($sql,$db);
|
|
$item = mysql_fetch_array($result);
|
|
$catnum=$item["id"];
|
|
$name=$category_selected;
|
|
|
|
?>
|
|
<?
|
|
include("mysql_compat.php");
|
|
$sql="SELECT * FROM articles where id_cat=$catnum";
|
|
$result=mysql_query($sql,$db);
|
|
while ($item = mysql_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">
|
|
|
|
<?
|
|
include("mysql_compat.php");
|
|
$sujet=$article_selected;
|
|
$doitonce=0;
|
|
$space='width="15%"';
|
|
$result=mysql_query($sql,$db);
|
|
while ($item = mysql_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=\"article.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égorie.<BR>";
|
|
}
|
|
?>
|
|
</TABLE>
|
|
|