par
archos6 » 22 sept. 2005, 11:14

Je te remercie de t intéresser à mon problème
je te donne tout le code ça donne une idée plus précise. J avais mis les balises codes mais jai mis les balises PHP.
j ai aussi mis des couleurs et commentés les différentes parties.
Le programme fonctionne mais l'affichage ne se fait que sur le premier critère qui correspond à la variable VARauteur. Il n y a pas de messages d'erreur.
Le problème doit se situer dans - Traduction en PHP de la requête mySQL
Tout autres précisions et améliorations sur demande
<?php require_once('../Connections/artnetvideo2.php'); ?>
<?php
// Concerne la région répétée pour l affchage
$maxRows_rstableau = 10;
$pageNum_rstableau = 0;
if (isset($_GET['pageNum_rstableau'])) {
$pageNum_rstableau = $_GET['pageNum_rstableau'];
}
$startRow_rstableau = $pageNum_rstableau * $maxRows_rstableau;
// [color=darkred]DECLARATION de la valeur VARauteur[/color]
$colname_rstableau = "peinture"; // donner une donnée
if (isset($_GET['VARauteur'])) {
$colname_rstableau = (get_magic_quotes_gpc()) ? $_GET['VARauteur'] : addslashes($_GET['VARauteur']);
}
// Région répétée pour l'affichage des données
$maxRows_rstableau = 10;;
$pageNum_rstableau = 0;
if (isset($_GET['pageNum_rstableau'])) {
$pageNum_rstableau = $_GET['pageNum_rstableau'];
}
$startRow_rstableau = $pageNum_rstableau * $maxRows_rstableau;
// [color=darkred]Déclaration de la variable VARthemeoeuvre[/color]
$colname2_rstableau = "abstrait";
if (isset( $_GET['VARthemeoeuvre'])) {
$colname2_rstableau = (get_magic_quotes_gpc()) ? $_GET['VARthemeoeuvre'] : addslashes( $_GET['VARthemeoeuvre']);
}
// [color=darkred]Traduction en PHP de la requête mySQL[/color]
mysql_select_db($database_artnetvideo2, $artnetvideo2);
$query_rstableau = sprintf("SELECT * FROM articles WHERE auteur LIKE '%%colname%%' AND themeoeuvre LIKE '%%%s%%'", $colname2_rstableau);
$query_limit_rstableau = sprintf("%s LIMIT %d, %d", $query_rstableau, $startRow_rstableau, $maxRows_rstableau);
$rstableau = mysql_query($query_limit_rstableau, $artnetvideo2) or die(mysql_error());
$row_rstableau = mysql_fetch_assoc($rstableau);
// [color=darkred]région répétée pour affichage des données[/color]
if (isset($_GET['totalRows_rstableau'])) {
$totalRows_rstableau = $_GET['totalRows_rstableau'];
} else {
$all_rstableau = mysql_query($query_rstableau);
$totalRows_rstableau = mysql_num_rows($all_rstableau);
}
$totalPages_rstableau = ceil($totalRows_rstableau/$maxRows_rstableau)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Style2 {
color: #FF0000;
font-size: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Style4 {
color: #FF0000;
font-size: 14px;
}
body {
background-color: #FFFFFF;
background-image: url();
}
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.Style14 {font-size: 18px; font-weight: bold; }
.Style21 {color: #CCCCCC}
.Style22 {
color: #000000;
font-size: 12px;
}
.Style23 {font-size: 12px; font-weight: bold; }
.Style24 {font-size: 12px}
.Style25 {font-size: 12}
.Style30 {
font-size: 13px;
color: #FFFFFF;
}
.Style31 {color: #999999; }
.Style44 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #0000FF;
font-size: 12;
}
.Style50 {
color: #000000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="745" height="32" border="0" bgcolor="#CCCCCC">
<tr>
<th width="206" bordercolor="#FF0000" bgcolor="#FF3366" scope="col"> </th>
<th width="529" bgcolor="#FF0066" scope="col">Recherches Multicritère </th>
</tr>
</table>
<table width="100%" >
<tr>
<td width="28%" height="100%" align="center" valign="top" bgcolor="#0099FF"><p align="center" class="Style50"> RECHERCHES</p>
[color=darkred]// zone HTML DU FORMULAIRE DE SAISIE
// En utilisant les variables VARauteur et VARthemeoeuvre[/color]
<form name="form1" method="get" action="recherche-multicriteres.php">
<p align="center"> </p>
<p align="center">Portrait, paysage, nu, nature morte..</p>
<p align="center">
<select name="VARauteur" id="VARauteur">
<option value="Peinture">Peinture</option>
<option value="sculpture">sculpture</option>
<option value="Photographie">Photographie</option>
<option value="collage">collage</option>
</select>
</p>
<p align="center">
<select name="VARthemeoeuvre" id="VARthemeoeuvre">
<option value="portrait">portrait</option>
<option value="abstrait">abstrait</option>
<option value="nu">nu</option>
<option value="nature morte">nature morte</option>
</select>
</p>
<p align="center"> </p>
<p align="center"> <input type="submit" name="Submit" value="OK">
</p>
<p align="center"><em></em></p>
</form>
<p align="center"><em><strong>Autres recherches </strong></em></p>
<p align="center"><a href="recherche-format.php">Dimension</a>, <a href="recherche-theme.php">Thème</a>, <a href="recherche-artiste.php">artiste</a>, <a href="recherche-prix1.php">prix</a>, <a href="recherche-titre.php">Titre</a>, <a href="recherche-technique.php">Techniques </a></p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"><a href="catalogu-informatique.php"> </a></p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p></td>
<td width="72%" align="center" valign="top" bgcolor="#FFFFFF"><div align="center">
// AFFICHAGE DES DONNEES suite de la région répétée
<table width="96%" height="195" border="1" align="center" bordercolor="#0000FF" bgcolor="#CCCCCC">
<tr bordercolor="#000000">
<?php do {
if (($maxRows_rstableau+2)%3 == 0) {
echo '</tr><tr>'; }
$maxRows_rstableau++;
?>
[color=red]// Zone affichage des données provenant de la base MySQL[/color]
<td width="547" height="189" valign="top" bordercolor="#0000FF" bgcolor="#FFFFFF"> <p align="center" class="Style2"><img src="../images/<?php echo $row_rstableau['photo']; ?>"></p>
<p align="center" class="Style2"><?php echo $row_rstableau['reference']; ?></p>
<p align="center"><a href="fiche.php?reference=<?php echo $row_rstableau['reference']; ?>" class="Style4"> <span class="Style44"><?php echo $row_rstableau['titre']; ?></span></a></p>
<p align="center"><?php echo $row_rstableau['prix']; ?> </p>
</td>
<?php } while ($row_rstableau = mysql_fetch_assoc($rstableau)); ?>
</tr>
</table>
<p> </p>
</div></td>
</tr>
</table>
<p>______________________________________________________________________________________________</p>
<table width="751" border="0">
<tr>
<th width="268" scope="col"><div align="right" class="Style31">Nous contacter</div></th>
<th width="159" scope="col"><span class="Style31">Mentions légales </span></th>
<th width="284" scope="col"><div align="left" class="Style31">Copyright - Ma socièté droit déposé</div></th>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($rstableau);
mysql_free_result($rstableau);
?>
:D Je te remercie de t intéresser à mon problème
je te donne tout le code ça donne une idée plus précise. J avais mis les balises codes mais jai mis les balises PHP.
j ai aussi mis des couleurs et commentés les différentes parties.
Le programme fonctionne mais l'affichage ne se fait que sur le premier critère qui correspond à la variable VARauteur. Il n y a pas de messages d'erreur.
Le problème doit se situer dans - Traduction en PHP de la requête mySQL
[color=red]Tout autres précisions et améliorations sur demande[/color]
[php]
<?php require_once('../Connections/artnetvideo2.php'); ?>
<?php
// Concerne la région répétée pour l affchage
$maxRows_rstableau = 10;
$pageNum_rstableau = 0;
if (isset($_GET['pageNum_rstableau'])) {
$pageNum_rstableau = $_GET['pageNum_rstableau'];
}
$startRow_rstableau = $pageNum_rstableau * $maxRows_rstableau;
// [color=darkred]DECLARATION de la valeur VARauteur[/color]
$colname_rstableau = "peinture"; // donner une donnée
if (isset($_GET['VARauteur'])) {
$colname_rstableau = (get_magic_quotes_gpc()) ? $_GET['VARauteur'] : addslashes($_GET['VARauteur']);
}
// Région répétée pour l'affichage des données
$maxRows_rstableau = 10;;
$pageNum_rstableau = 0;
if (isset($_GET['pageNum_rstableau'])) {
$pageNum_rstableau = $_GET['pageNum_rstableau'];
}
$startRow_rstableau = $pageNum_rstableau * $maxRows_rstableau;
// [color=darkred]Déclaration de la variable VARthemeoeuvre[/color]
$colname2_rstableau = "abstrait";
if (isset( $_GET['VARthemeoeuvre'])) {
$colname2_rstableau = (get_magic_quotes_gpc()) ? $_GET['VARthemeoeuvre'] : addslashes( $_GET['VARthemeoeuvre']);
}
// [color=darkred]Traduction en PHP de la requête mySQL[/color]
mysql_select_db($database_artnetvideo2, $artnetvideo2);
$query_rstableau = sprintf("SELECT * FROM articles WHERE auteur LIKE '%%colname%%' AND themeoeuvre LIKE '%%%s%%'", $colname2_rstableau);
$query_limit_rstableau = sprintf("%s LIMIT %d, %d", $query_rstableau, $startRow_rstableau, $maxRows_rstableau);
$rstableau = mysql_query($query_limit_rstableau, $artnetvideo2) or die(mysql_error());
$row_rstableau = mysql_fetch_assoc($rstableau);
// [color=darkred]région répétée pour affichage des données[/color]
if (isset($_GET['totalRows_rstableau'])) {
$totalRows_rstableau = $_GET['totalRows_rstableau'];
} else {
$all_rstableau = mysql_query($query_rstableau);
$totalRows_rstableau = mysql_num_rows($all_rstableau);
}
$totalPages_rstableau = ceil($totalRows_rstableau/$maxRows_rstableau)-1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.Style2 {
color: #FF0000;
font-size: 16px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.Style4 {
color: #FF0000;
font-size: 14px;
}
body {
background-color: #FFFFFF;
background-image: url();
}
a:link {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #000000;
}
a:active {
color: #000000;
}
.Style14 {font-size: 18px; font-weight: bold; }
.Style21 {color: #CCCCCC}
.Style22 {
color: #000000;
font-size: 12px;
}
.Style23 {font-size: 12px; font-weight: bold; }
.Style24 {font-size: 12px}
.Style25 {font-size: 12}
.Style30 {
font-size: 13px;
color: #FFFFFF;
}
.Style31 {color: #999999; }
.Style44 {
font-family: Verdana, Arial, Helvetica, sans-serif;
color: #0000FF;
font-size: 12;
}
.Style50 {
color: #000000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<table width="745" height="32" border="0" bgcolor="#CCCCCC">
<tr>
<th width="206" bordercolor="#FF0000" bgcolor="#FF3366" scope="col"> </th>
<th width="529" bgcolor="#FF0066" scope="col">Recherches Multicritère </th>
</tr>
</table>
<table width="100%" >
<tr>
<td width="28%" height="100%" align="center" valign="top" bgcolor="#0099FF"><p align="center" class="Style50"> RECHERCHES</p>
[color=darkred]// zone HTML DU FORMULAIRE DE SAISIE
// En utilisant les variables VARauteur et VARthemeoeuvre[/color]
<form name="form1" method="get" action="recherche-multicriteres.php">
<p align="center"> </p>
<p align="center">Portrait, paysage, nu, nature morte..</p>
<p align="center">
<select name="VARauteur" id="VARauteur">
<option value="Peinture">Peinture</option>
<option value="sculpture">sculpture</option>
<option value="Photographie">Photographie</option>
<option value="collage">collage</option>
</select>
</p>
<p align="center">
<select name="VARthemeoeuvre" id="VARthemeoeuvre">
<option value="portrait">portrait</option>
<option value="abstrait">abstrait</option>
<option value="nu">nu</option>
<option value="nature morte">nature morte</option>
</select>
</p>
<p align="center"> </p>
<p align="center"> <input type="submit" name="Submit" value="OK">
</p>
<p align="center"><em></em></p>
</form>
<p align="center"><em><strong>Autres recherches </strong></em></p>
<p align="center"><a href="recherche-format.php">Dimension</a>, <a href="recherche-theme.php">Thème</a>, <a href="recherche-artiste.php">artiste</a>, <a href="recherche-prix1.php">prix</a>, <a href="recherche-titre.php">Titre</a>, <a href="recherche-technique.php">Techniques </a></p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"><a href="catalogu-informatique.php"> </a></p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p>
<p align="center" class="Style21"> </p></td>
<td width="72%" align="center" valign="top" bgcolor="#FFFFFF"><div align="center">
// AFFICHAGE DES DONNEES suite de la région répétée
<table width="96%" height="195" border="1" align="center" bordercolor="#0000FF" bgcolor="#CCCCCC">
<tr bordercolor="#000000">
<?php do {
if (($maxRows_rstableau+2)%3 == 0) {
echo '</tr><tr>'; }
$maxRows_rstableau++;
?>
[color=red]// Zone affichage des données provenant de la base MySQL[/color]
<td width="547" height="189" valign="top" bordercolor="#0000FF" bgcolor="#FFFFFF"> <p align="center" class="Style2"><img src="../images/<?php echo $row_rstableau['photo']; ?>"></p>
<p align="center" class="Style2"><?php echo $row_rstableau['reference']; ?></p>
<p align="center"><a href="fiche.php?reference=<?php echo $row_rstableau['reference']; ?>" class="Style4"> <span class="Style44"><?php echo $row_rstableau['titre']; ?></span></a></p>
<p align="center"><?php echo $row_rstableau['prix']; ?> </p>
</td>
<?php } while ($row_rstableau = mysql_fetch_assoc($rstableau)); ?>
</tr>
</table>
<p> </p>
</div></td>
</tr>
</table>
<p>______________________________________________________________________________________________</p>
<table width="751" border="0">
<tr>
<th width="268" scope="col"><div align="right" class="Style31">Nous contacter</div></th>
<th width="159" scope="col"><span class="Style31">Mentions légales </span></th>
<th width="284" scope="col"><div align="left" class="Style31">Copyright - Ma socièté droit déposé</div></th>
</tr>
</table>
<p> </p>
<p> </p>
</body>
</html>
<?php
mysql_free_result($rstableau);
mysql_free_result($rstableau);
?>
[/php]