Hi, this is the code I written to show some infons on houses.. to see the script working.. go to : http://www.2big.org/test/requete.php?action=1
(sometime it's busy..)
My problem is that I'll search for a simpler way to switch from pages.. Anyone could help me plz.. I will add your name in the credits...
Ok now this is the code..
<?php
/
PAR STEVE TÉTRAULT TOUT DROITS RÉSERVÉS
Affichage général des villas disponibles.
/
$con = mysql_connect(localhost,twobig,841819519) or die("Impossible de se connecter a la database.<br>" . mysql_error());
$sql = "select * from requete";
$result = mysql_db_query("twobig",$sql,$con);
$temppages = mysql_num_rows($result) / 5; #Divise par le nombre a afficher par page
$pages = ceil($temppages); #Arrondissement au plus gros ex : 1.4 > 2
if (isset($action)) {
$i = 1;
while($i <= 10):
if ($action == "$i") {
if ($i == "1") {
$VALID = 0;}
if ($i == "2") {
$VALID = 5;}
if ($i == "3") {
$VALID = 10;}
if ($i == "4") {
$VALID = 15;}
if ($i == "5") {
$VALID = 20;}
if ($i == "6") {
$VALID = 25;}
if ($i == "7") {
$VALID = 30;}
if ($i == "8") {
$VALID = 35;}
if ($i == "9") {
$VALID = 40;}
if ($i == "10") {
$VALID = 45;}
}
$i++;
endwhile;
mysql_connect(localhost,twobig,841819519) or die("Erreur d'acces a la database.<br>" . mysql_error());
mysql_select_db(twobig) or die("ON ne peut pas sélectionner de database.<br>" . mysql_error());
?>
<table width="72%" border="0" cellpadding="0">
<tr>
<td width="40%">
<?php
$con = mysql_connect(localhost,twobig,841819519) or die("Impossible de se connecter a la database.<br>" . mysql_error());
$sql = "select from requete";
$result = mysql_db_query("twobig",$sql,$con);
echo $rows = mysql_num_rows($result);
?>
Villas Trouvées</td>
<td width="40%">
<div align="right">
<?php
$liens = 1;
echo "Pages: ";
while ($liens <= $pages):
echo " [<a href='requete.php?action=$liens'>$liens</a>] ";
$liens++;
endwhile;
?>
</div>
</td>
</tr>
</table>
<?php
/ Début de l'affichage de la requete /
$sql = "SELECT FROM requete WHERE ID > $VALID";
$query = mysql_query($sql) or die("Erreur Database<br>" .mysql_error());
?>
<img src="trait.gif" width="540" height="1">
<table width="75%" border="0" cellpadding="0">
<tr>
<td height="49">
<table width="100%" border="0" cellpadding="0">
<?php
$series = 0;
while($result = mysql_fetch_array($query)) {
if ( $series >= 5 ) {
break; / You could also write 'break 1;' here. /
}
$ID = stripslashes($result["ID"]);
$Nom = stripslashes($result["Nom"]);
$Personne = stripslashes($result["Personne"]);
$Description = stripslashes($result["Description"]);
$Images = stripslashes($result["Images"]);
?>
<tr>
<td width="20%" height="41">
<?php echo "<img src=\""; echo "$Images"; echo "\">"; ?>
</td>
<td width="80%" valign=top height="41">
<table width="100%" border="0" cellpadding="0">
<tr>
<td><font size="2" color="#330099">
<?php print "<b>Reference : $ID </b>"; ?>
</font></td>
</tr>
<tr>
<td><font size="2" color="#003300">
<?php print "<u>$Nom</u>, $Personne Personne(s)"; ?>
</font></td>
</tr>
<tr>
<td height="2"><font size="2" color="#330099">
<?php print "$Description" ?>
</font></td>
</tr>
</table>
</td>
</tr>
<?php
$series++;
} ?>
</table>
</td>
</tr>
</table>
<?php
} else { print "aucune page choisie";}
?>
<img src="trait.gif" width="540" height="1">