$_GET['valeur']

Résolu
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013 - 30 sept. 2009 à 12:03
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 - 2 oct. 2009 à 10:33
Salut,

Voilà, j'ai un tit soucis avec un moteur de recherche multi-critères.

C'est un moteur de recherche pour agence immobilière, et je dois pouvoir faire un multiple choix de ville.


"moteur.php"

Bien enttendu il y a une requete qui va chercher toutes les villes dans la BDD

<select name= "ville[]" size="5" multiple="MULTIPLE" id="ville">
<?php
do {
?>
<option value="<?php echo $row_R_listevilles['ville']?>"><?php echo $row_R_listevilles['ville']?></option>
<?php
} while ($row_R_listevilles = mysql_fetch_assoc($R_listevilles));
$rows = mysql_num_rows($R_listevilles);
if($rows > 0) {
mysql_data_seek($R_listevilles, 0);
$row_R_listevilles = mysql_fetch_assoc($R_listevilles);
}
?>
</select>



resultats-recherche.php


mysql_select_db($database_mabase, $mabase);


$query_R_resultats_recherche sprintf("SELECT * FROM biens WHERE bien %s AND type_fr = %s AND pays = %s AND pieces = %s AND prix >= %s AND prix <= %s AND ville =" . $ville . "",
GetSQLValueString($varbien_R_resultats_recherche, "text"),
GetSQLValueString($vartype_R_resultats_recherche, "text"),
GetSQLValueString($varpays_R_resultats_recherche, "text"),
GetSQLValueString($varpiece_R_resultats_recherche, "text"),
GetSQLValueString($varmin_R_resultats_recherche, "int"),
GetSQLValueString($varmax_R_resultats_recherche, "int"),
GetSQLValueString($varville_R_resultats_recherche, "text"));

$R_resultats_recherche = mysql_query($query_R_resultats_recherche, $mabase) or die(mysql_error());




Le problème, c'est que ca ne m'affiche que 1 seule ville, et non pas toutes les villes sélectionnées. J'immagine qu'il doit y avoir un while ou foreach quelque part à caler. Mais ou ?

Je n'ai jamais fais de boucle dans une requete et c'est là que ca bloque :(

Quelqu'un aurrait une solution svp???


Merci d'avance

VestaX

33 réponses

Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
30 sept. 2009 à 17:07
Et bien il prends en compte tout ca :
bien = 'Achat'
type_fr = 'Appartement'
pays = 'France'
pieces = '2'
prix >= 0
prix <= 2147483647

mais il trouve pas de ville...
donc il les prends pas en compte, normal...
Peut être que ton URL est trop longue...

Tiens envoie l'url générée après l'envoi de ton formulaire...
_________________________________
Min iPomme
0
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013
30 sept. 2009 à 17:15
il me renvoi ca:

http://localhost/...


mais il me ressort quand même ca:

==============
villes:Antibes - Juan-Les-Pins -Cannes -
query:SELECT * FROM biens WHERE bien 'Achat' AND type_fr 'Appartement' AND pays = 'France' AND pieces = '1' AND prix >= 0 AND prix <= 2147483647





VestaX
www.jm-studio.eu
0
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
30 sept. 2009 à 17:20
Après le
echo "
query:$query_R_resultats_recherche";

que je t'ai fais ajouté, fais un

echo "
VARCOUNT:".count($_GET['ville']);

Quel résultat :D ???
_________________________________
Min iPomme
0
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013
30 sept. 2009 à 17:26
villes:Biot -Cannes -
query:SELECT * FROM biens WHERE bien 'Achat' AND type_fr 'Appartement' AND pays = 'France' AND pieces = '2' AND prix >= 0 AND prix <= 2147483647
VARCOUNT:2



VestaX
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
30 sept. 2009 à 18:51
OoOo

Il faut utiliser $query_R_resultats_recherche partout !!!!
Dans ce que je t'ai fais ajouter tu as entré $query_r_resultats_recherche or php est aussi sensible à la casse...

Tu peux enlever les :
echo "
==============
villes:";
foreach($_GET['ville'] as $value)
echo "$value -";
echo "
query:$query_R_resultats_recherche";
...
exit();

Et re-tester...

_________________________________
Min iPomme
0
0303 Messages postés 13 Date d'inscription jeudi 11 décembre 2008 Statut Membre Dernière intervention 7 novembre 2009
1 oct. 2009 à 11:12
Bonjour !

je cherche un script de news en PHP/MYSQL

avec ce script on peut poster les différents champs tels que :

la page inserer.php

Titre de la news
Brève de la news
Contenu de la news et
Parcourir un fichier (n'importe format c.à.d gif, jpeg, jpg, pdf, doc etc.)

la page affichage.php

affiche le Titre, Brève, Contenu et le fichier joint.(5 affichages par page)

est que quelqu'un peut m'aider?

je suis débutant en php

Merci
0
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
1 oct. 2009 à 11:17
Pourquoi ne poste tu pas un nouveau message ?
Pourquoi ne recherche tu pas si ça existe avant de poser la question ?

_________________________________
Min iPomme
0
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013
1 oct. 2009 à 11:22
Tonio_35

Je veux bien essayer, mais le problème, c'est que je n'ai plus internet depuis ce matin.
J'espère que ca sera remis cet après midi.

Je te tiens au courrant.

merci encore


VestaX
0
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013
1 oct. 2009 à 15:37
Enfin la connexion.

Ca ne marche toujours pas. j'ai mis les $query_R_resultats_recherche partout avec majuscules. Sans succés.



VestaX
www.jm-studio.eu
0
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
2 oct. 2009 à 09:41
Bon j'ai fini par me créer une petite base de donnée pour tester...

Et voila un code qui fonctionne (J'ai ajouté un peut de sécurité sur l'affichage de tes annonces avec le htmlspecialchars:

<?php
if (!isset($_SESSION))
{
session_start();
}
require_once('../Connections/arimmobilier.php');

$MM_authorizedUsers =  "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup)
{
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName))
{
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers))
{
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups))
{
$isValid = true;
}
if (($strUsers == "") && true)
{
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "erreur-auth.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup']))))
{
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?"))
$MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit("Redirection...");
}
?>
<?php
if (!function_exists("GetSQLValueString"))
{
function GetSQLValueString($theValue, $theType, $theDefinedValue "", $theNotDefinedValue "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_R_fiches = 15;
$pageNum_R_fiches = 0;
if (isset($_GET['pageNum_R_fiches']))
{
$pageNum_R_fiches = $_GET['pageNum_R_fiches'];
}
$startRow_R_fiches = $pageNum_R_fiches * $maxRows_R_fiches;

// Requete SQL
mysql_select_db($database_arimmobilier, $arimmobilier);
$query_R_fiches = "SELECT * FROM biens ORDER BY prix ASC";
$query_limit_R_fiches = sprintf("%s LIMIT %d, %d", $query_R_fiches, $startRow_R_fiches, $maxRows_R_fiches);
$R_fiches = mysql_query($query_limit_R_fiches, $arimmobilier) or die(mysql_error());
$row_R_fiches = mysql_fetch_assoc($R_fiches);

if (isset($_GET['totalRows_R_fiches']))
{
$totalRows_R_fiches = $_GET['totalRows_R_fiches'];
}
else
{
$all_R_fiches = mysql_query($query_R_fiches);
$totalRows_R_fiches = mysql_num_rows($all_R_fiches);
}
$totalPages_R_fiches = ceil($totalRows_R_fiches/$maxRows_R_fiches)-1;

$varbien_R_resultats_recherche = "-1";
if (isset($_GET['bien']))
{
$varbien_R_resultats_recherche = $_GET['bien'];
}
$varmin_R_resultats_recherche = "-1";
if (isset($_GET['prixmin']))
{
if ($_GET['prixmin'] == "")
{
$varmin_R_resultats_recherche = "0" ;
}
else
{
$varmin_R_resultats_recherche = $_GET['prixmin'];
}
}
$varmax_R_resultats_recherche = "-1";
if (isset($_GET['prixmax']))
{
if ($_GET['prixmax'] == "")
{
$varmax_R_resultats_recherche = "9999999999999" ;
}
else
{
$varmax_R_resultats_recherche = $_GET['prixmax'];
}
}

$varpiece_R_resultats_recherche = "%";
if (isset($_GET['pieces']))
{
if ($_GET['pieces'] == "")
{
$varpiece_R_resultats_recherche = "" ;
}
else
{
$varpiece_R_resultats_recherche = $_GET['pieces'];
}
}
$varpays_R_resultats_recherche = "-1";
if (isset($_GET['pays']))
{
$varpays_R_resultats_recherche = $_GET['pays'];
}
$vartype_R_resultats_recherche = "-1";
if (isset($_GET['type_fr']))
{
$vartype_R_resultats_recherche = $_GET['type_fr'];
}
/*********************
debut modif
*********************/
mysql_select_db($database_arimmobilier, $arimmobilier);


$query_R_resultats_recherche sprintf("select * from biens where bien %s and type_fr = %s and pays = %s and pieces = %s and prix >= %s and prix <= %s",
getsqlvaluestring($varbien_R_resultats_recherche, "text"),
getsqlvaluestring($vartype_R_resultats_recherche, "text"),
getsqlvaluestring($varpays_R_resultats_recherche, "text"),
getsqlvaluestring($varpiece_R_resultats_recherche, "text"),
getsqlvaluestring($varmin_R_resultats_recherche, "int"),
getsqlvaluestring($varmax_R_resultats_recherche, "int")
);
// on parcours le tableau de villes recherchées si au moins une ville à été séléctionnée
if(isset($_GET['ville']))
{

if(!is_array($_GET['ville']))
{
$villearr = array();
$villearr[] = $_GET['ville'];
}
else
{
$villearr = $_GET['ville'];
}
if(count($villearr) > 0)
{
$query_R_resultats_recherche .= " and (";

foreach($villearr as $value)
{
$query_R_resultats_recherche .= 'ville like '.getsqlvaluestring($value, "text").' or ';
}
// on supprime le dernier  or  en trop
$query_R_resultats_recherche = substr($query_R_resultats_recherche, 0, -4);
$query_R_resultats_recherche .= ")";
}
}
echo $query_R_resultats_recherche;

/*********************
fin modif
*********************/

$R_resultats_recherche = mysql_query($query_R_resultats_recherche, $arimmobilier) or die(mysql_error());
$row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche);
$totalRows_R_resultats_recherche = mysql_num_rows($R_resultats_recherche);

$maxRows_R_resultats_recherche = 15;
$pageNum_R_resultats_recherche = 0;
if (isset($_GET['pageNum_R_resultats_recherche']))
{
$pageNum_R_resultats_recherche = $_GET['pageNum_R_resultats_recherche'];
}
$startRow_R_resultats_recherche = $pageNum_R_resultats_recherche * $maxRows_R_resultats_recherche;

$varbien_R_resultats_recherche = "-1";
if (isset($_GET['bien']))
{
$varbien_R_resultats_recherche = $_GET['bien'];
}




$queryString_R_resultats_recherche = "";
if (!empty($_SERVER['QUERY_STRING']))
{
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param)
{
if (stristr($param, "pageNum_R_resultats_recherche") false && stristr($param, "totalRows_R_resultats_recherche") false)
{
array_push($newParams, $param);
}
}
if (count($newParams) != 0)
{
$queryString_R_resultats_recherche = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_R_resultats_recherche = sprintf("&totalRows_R_resultats_recherche=%d%s", $totalRows_R_resultats_recherche, $queryString_R_resultats_recherche);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Style6 {color: #FFFFFF; font-weight: bold; }
-->
</style>
</head>



 ADMINISTRATION 







<?php include('inc/moteur.php') ;?>,
<table width ="100%" border="0" cellspacing="0" cellpadding="0">
----, <table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#333333\">
----

<?php
include('inc/menu.php');
?>
</td>
</tr>

</table>





,
Ajouter une fiche



Résultats de votre recherche: <?php echo $totalRows_R_resultats_recherche ?> réponse(s)






<?php
if ($totalRows_R_resultats_recherche > 0)
{
// Show if recordset not empty ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
----,  </td>
,
,

----

,
REF,
BIENS,
TYPES,
VILLES,
PRIX,
,

----

,
,
,

<?php
do {
?>
----

"> ">,
<?php echo htmlspecialchars($row_R_resultats_recherche['ref']); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['bien']); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['type_fr']); ?>,
<?php echo htmlspecialchars(substr($row_R_resultats_recherche['ville'],0,7)); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['prix']); ?> €,
,

----

,

<?php
} while ($row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche)); ?>


 

<?php
if ($totalRows_R_resultats_recherche > 0)
{
// Show if recordset not empty
?>
<?php
echo ($startRow_R_resultats_recherche + 1) ?> à <?php echo min($startRow_R_resultats_recherche + $maxRows_R_resultats_recherche, $totalRows_R_resultats_recherche) ?> sur <?php echo $totalRows_R_resultats_recherche ?>

">Début ">Précédent ">Suivant ">Fin

<?php
}
// Show if recordset not empty
?>





</td>
</tr>
</table>
<?php
}
// Show if recordset not empty
?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table>



</html>
<?php
mysql_free_result($R_fiches);
mysql_free_result($R_resultats_recherche);
?>



_________________________________
Min iPomme
0
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
2 oct. 2009 à 09:43
Je te le remet sans la coloration histoire d'avoir les Lettres en majuscule...

<?php
if (!isset($_SESSION))
{
session_start();
}
require_once('../Connections/arimmobilier.php');

$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup)
{
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName))
{
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers))
{
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups))
{
$isValid = true;
}
if (($strUsers == "") && true)
{
$isValid = true;
}
}
return $isValid;
}

$MM_restrictGoTo = "erreur-auth.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup']))))
{
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?"))
$MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit("Redirection...");
}
?>
<?php
if (!function_exists("GetSQLValueString"))
{
function GetSQLValueString($theValue, $theType, $theDefinedValue "", $theNotDefinedValue "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_R_fiches = 15;
$pageNum_R_fiches = 0;
if (isset($_GET['pageNum_R_fiches']))
{
$pageNum_R_fiches = $_GET['pageNum_R_fiches'];
}
$startRow_R_fiches = $pageNum_R_fiches * $maxRows_R_fiches;

// Requete SQL
mysql_select_db($database_arimmobilier, $arimmobilier);
$query_R_fiches = "SELECT * FROM biens ORDER BY prix ASC";
$query_limit_R_fiches = sprintf("%s LIMIT %d, %d", $query_R_fiches, $startRow_R_fiches, $maxRows_R_fiches);
$R_fiches = mysql_query($query_limit_R_fiches, $arimmobilier) or die(mysql_error());
$row_R_fiches = mysql_fetch_assoc($R_fiches);

if (isset($_GET['totalRows_R_fiches']))
{
$totalRows_R_fiches = $_GET['totalRows_R_fiches'];
}
else
{
$all_R_fiches = mysql_query($query_R_fiches);
$totalRows_R_fiches = mysql_num_rows($all_R_fiches);
}
$totalPages_R_fiches = ceil($totalRows_R_fiches/$maxRows_R_fiches)-1;

$varbien_R_resultats_recherche = "-1";
if (isset($_GET['bien']))
{
$varbien_R_resultats_recherche = $_GET['bien'];
}
$varmin_R_resultats_recherche = "-1";
if (isset($_GET['prixmin']))
{
if ($_GET['prixmin'] == "")
{
$varmin_R_resultats_recherche = "0" ;
}
else
{
$varmin_R_resultats_recherche = $_GET['prixmin'];
}
}
$varmax_R_resultats_recherche = "-1";
if (isset($_GET['prixmax']))
{
if ($_GET['prixmax'] == "")
{
$varmax_R_resultats_recherche = "9999999999999" ;
}
else
{
$varmax_R_resultats_recherche = $_GET['prixmax'];
}
}

$varpiece_R_resultats_recherche = "%";
if (isset($_GET['pieces']))
{
if ($_GET['pieces'] == "")
{
$varpiece_R_resultats_recherche = "" ;
}
else
{
$varpiece_R_resultats_recherche = $_GET['pieces'];
}
}
$varpays_R_resultats_recherche = "-1";
if (isset($_GET['pays']))
{
$varpays_R_resultats_recherche = $_GET['pays'];
}
$vartype_R_resultats_recherche = "-1";
if (isset($_GET['type_fr']))
{
$vartype_R_resultats_recherche = $_GET['type_fr'];
}
/*********************
debut modif
*********************/
mysql_select_db($database_arimmobilier, $arimmobilier);


$query_R_resultats_recherche sprintf("select * from biens where bien %s and type_fr = %s and pays = %s and pieces = %s and prix >= %s and prix <= %s",
getsqlvaluestring($varbien_R_resultats_recherche, "text"),
getsqlvaluestring($vartype_R_resultats_recherche, "text"),
getsqlvaluestring($varpays_R_resultats_recherche, "text"),
getsqlvaluestring($varpiece_R_resultats_recherche, "text"),
getsqlvaluestring($varmin_R_resultats_recherche, "int"),
getsqlvaluestring($varmax_R_resultats_recherche, "int")
);
// on parcours le tableau de villes recherchées si au moins une ville à été séléctionnée
if(isset($_GET['ville']))
{

if(!is_array($_GET['ville']))
{
$villearr = array();
$villearr[] = $_GET['ville'];
}
else
{
$villearr = $_GET['ville'];
}
if(count($villearr) > 0)
{
$query_R_resultats_recherche .= " and (";

foreach($villearr as $value)
{
$query_R_resultats_recherche .= 'ville like '.getsqlvaluestring($value, "text").' or ';
}
// on supprime le dernier or en trop
$query_R_resultats_recherche = substr($query_R_resultats_recherche, 0, -4);
$query_R_resultats_recherche .= ")";
}
}
echo $query_R_resultats_recherche;

/*********************
fin modif
*********************/

$R_resultats_recherche = mysql_query($query_R_resultats_recherche, $arimmobilier) or die(mysql_error());
$row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche);
$totalRows_R_resultats_recherche = mysql_num_rows($R_resultats_recherche);

$maxRows_R_resultats_recherche = 15;
$pageNum_R_resultats_recherche = 0;
if (isset($_GET['pageNum_R_resultats_recherche']))
{
$pageNum_R_resultats_recherche = $_GET['pageNum_R_resultats_recherche'];
}
$startRow_R_resultats_recherche = $pageNum_R_resultats_recherche * $maxRows_R_resultats_recherche;

$varbien_R_resultats_recherche = "-1";
if (isset($_GET['bien']))
{
$varbien_R_resultats_recherche = $_GET['bien'];
}




$queryString_R_resultats_recherche = "";
if (!empty($_SERVER['QUERY_STRING']))
{
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param)
{
if (stristr($param, "pageNum_R_resultats_recherche") false && stristr($param, "totalRows_R_resultats_recherche") false)
{
array_push($newParams, $param);
}
}
if (count($newParams) != 0)
{
$queryString_R_resultats_recherche = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_R_resultats_recherche = sprintf("&totalRows_R_resultats_recherche=%d%s", $totalRows_R_resultats_recherche, $queryString_R_resultats_recherche);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.Style6 {color: #FFFFFF; font-weight: bold; }
-->
</style>
</head>



ADMINISTRATION







<?php include('inc/moteur.php') ;?>,
<table width ="100%" border="0" cellspacing="0" cellpadding="0">
----, <table width=\"98%\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#333333\">
----

<?php
include('inc/menu.php');
?>
</td>
</tr>

</table>





,
Ajouter une fiche



Résultats de votre recherche: <?php echo $totalRows_R_resultats_recherche ?> réponse(s)






<?php
if ($totalRows_R_resultats_recherche > 0)
{
// Show if recordset not empty ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
----, </td>
,
,

----

,
REF,
BIENS,
TYPES,
VILLES,
PRIX,
,

----

,
,
,

<?php
do {
?>
----

"> ">,
<?php echo htmlspecialchars($row_R_resultats_recherche['ref']); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['bien']); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['type_fr']); ?>,
<?php echo htmlspecialchars(substr($row_R_resultats_recherche['ville'],0,7)); ?>,
<?php echo htmlspecialchars($row_R_resultats_recherche['prix']); ?> €,
,

----

,

<?php
} while ($row_R_resultats_recherche = mysql_fetch_assoc($R_resultats_recherche)); ?>




<?php
if ($totalRows_R_resultats_recherche > 0)
{
// Show if recordset not empty
?>
<?php
echo ($startRow_R_resultats_recherche + 1) ?> à <?php echo min($startRow_R_resultats_recherche + $maxRows_R_resultats_recherche, $totalRows_R_resultats_recherche) ?> sur <?php echo $totalRows_R_resultats_recherche ?>

">Début ">Précédent ">Suivant ">Fin

<?php
}
// Show if recordset not empty
?>





</td>
</tr>
</table>
<?php
}
// Show if recordset not empty
?></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"> </td>
<td bgcolor="#FFFFFF"> </td>
</tr>
</table>



</html>
<?php
mysql_free_result($R_fiches);
mysql_free_result($R_resultats_recherche);
?>


_________________________________
Min iPomme
0
VestaX Messages postés 374 Date d'inscription mardi 2 décembre 2003 Statut Membre Dernière intervention 24 avril 2013
2 oct. 2009 à 09:50
Yo,

merci beaucoup tonio pour ton aide, mais c'est bon, je l'ai passé en sous traitance à quelqu'un qui me l'a fait en 2 2 :p


$listeVilles = "ville IN (";
  foreach( $varville_R_resultats_recherche as $selectValue) {
$listeVilles .= "'".$selectValue."',";
  }
$listeVilles .= "'xxx')";
  
mysql_select_db($database_arimmobilier, $arimmobilier);

$query_R_resultats_recherche sprintf("SELECT * FROM biens WHERE bien %s AND pays = %s AND type_fr = %s AND pieces = %s AND prix >= %s AND prix <= %s AND $listeVilles", GetSQLValueString($varbien_R_resultats_recherche, "text"),
  GetSQLValueString($varpays_R_resultats_recherche, "text"),
  GetSQLValueString($vartype_R_resultats_recherche, "text"),
  GetSQLValueString($varpieces_R_resultats_recherche, "int"),
  GetSQLValueString($varmin_R_resultats_recherche, "int"),
  GetSQLValueString($varmax_R_resultats_recherche, "int"));


tout simplement. Et ca marche niquel :p

Mais merci quand même pour tous ce mal que tu t'ai donné pour moi.

VestaX
0
Tonio_35 Messages postés 567 Date d'inscription mercredi 4 octobre 2006 Statut Membre Dernière intervention 30 août 2011 11
2 oct. 2009 à 10:33
Et bien de rien, bonne continuation !

_________________________________
Min iPomme
0
Rejoignez-nous