1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| <?php
include('../inc_connect.php');
$code_commerce = htmlspecialchars($_REQUEST['code_commerce']);
$departement = htmlspecialchars($_REQUEST['departement']);
$limit = 5;
$offset = ((isset($_REQUEST['offset']) && $_REQUEST['offset'] > 0) ? $_REQUEST['offset'] : 0);
$sql_limit = "LIMIT $offset, $limit";
$where = array();
if (isset($_REQUEST['code_commerce']) && strlen($_REQUEST['code_commerce'])) {
$where[] = "code_commerce = '".mysql_real_escape_string($_REQUEST['code_commerce'])."'";
}
if (isset($_REQUEST['departement']) && strlen($_REQUEST['departement'])) {
$where[] = "departement = '".mysql_real_escape_string($_REQUEST['departement'])."'";
}
if (isset($_REQUEST['ref']) && strlen($_REQUEST['ref'])) {
$where[] = "ref = '".mysql_real_escape_string($_REQUEST['ref'])."'";
}
$sql_Where = (empty($where)) ? null : 'WHERE '.implode(' AND ', $where);
$sql = "SELECT SQL_CALC_FOUND_ROWS * FROM tous_commerces2 $sql_Where $sql_limit";
$requete = mysql_query($sql, $cnx) or die( "ERREUR MYSQL numéro: ".mysql_errno()."<br>Type de cette erreur: ".mysql_error()."<br>\n" );
$i = @mysql_num_rows($requete); //comptage du nombre d'entrées sélectionnées par la recherche
if ($i == 0) //s'il n'y a pas de résultat
{
echo '<font color="#FF0000">Pas de résultat ....</font><br><font color="#808080">1 - Faites votre choix dans le type de commerce<br>2 - choisissez un département limitrophe<br>3 - cette référence peut ne plus exister (commerce vendu)</font>';
}
while ($donnees = @mysql_fetch_assoc( $requete ) )
{
?> |
Partager