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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
<?
// NOMBRE DE RESULTATS PAR PAGE
$limit=10;
// NOM DE CE SCRIPT
$script_name="index.php";
// PROGRAMME PRINCIPAL
if($debut==""){$debut=0;}
$debut=$page*$limit;
$sql="SELECT count(*) FROM nachatat order by date_nachatat desc";
$result = mysql_db_query($dbname,$sql) or die ('Erreur '.$sql.' '.mysql_error());
$nb_total=mysql_result($result,0,"count(*)");
$result=mysql_db_query($dbname,"select * from nachatat order by date_nachatat desc limit $debut,$limit");
$n2=mysql_num_rows($result);
if ($n2<>0){ $min=min($n2,10);
for($i=0;$i<$min;$i++) {$ligne=mysql_fetch_row($result);
$nachat=$ligne[1];
$data = $ligne[11];
$img_nom = $ligne[5];
$fichier=fopen("img_nachatat/image$i","w");
fwrite($fichier,$data);
fclose($fichier);
if ($ligne[11] != NULL) {
echo"<tr valign=\"top\"><TD height=\"102\">
</TD>
<TD width=\"391\" height=\"102\" align=\"right\">
<a href=nachat.php?nachat=$ligne[0]><font face=\"Arial\" size=\"3\" color=\"#CC6600\"><b> $nachat</b></font></a>
<p><font face=\"Arial\" size=\"3\" color=\"#000000\">$ligne[3] </font></td><TD width=\"1\" height=\"102\"> </td></tr>";
echo "<tr height=\"echo $ligne[8]\" width=\"echo $ligne[7]\"><td align=\"right\"><p><span lang=\"ar-ma\"><font face=\"Arial\" size=\"3\" color=\"#000000\"><img src=\"img_nachatat/image$i\"></font></td></tr>";
echo"<tr> <TD height=\"38\" colspan=\"2\">
<font color=\"#006699\">
...<b><font size=\"2\"><a href=nachat.php?nachat=$ligne[0]>التفاصيل</a></font></b>.......................................................</span></font><HR color=\"#000000\">
</TD>
<TD width=\"2\" height=\"38\">
</TD>
</tr>";
} else {
echo"<tr valign=\"top\"><TD height=\"102\">
</TD>
<TD width=\"391\" height=\"102\" align=\"right\">
<a href=nachat.php?nachat=$ligne[0]><font face=\"Arial\" size=\"3\" color=\"#CC6600\"><b> $nachat</b></font></a>
<p><font face=\"Arial\" size=\"3\" color=\"#000000\">$ligne[3] </font></td><TD width=\"1\" height=\"102\"> </td></tr>";
echo"<tr> <TD height=\"38\" colspan=\"2\">
<font color=\"#006699\">
...<b><font size=\"2\"><a href=nachat.php?nachat=$ligne[0]>التفاصيل</a></font></b>.......................................................</span></font><HR color=\"#000000\">
</TD>
<TD width=\"2\" height=\"38\">
</TD>
</tr>";
}
}
//echo"</table>";
}?>
<!--/TD>
<TD height="107"> </TD>
</TR-->
<tr>
<TD height="1" colspan="3"><? echo "<p align=\"center\"><font color=\"#006699\"><span lang=\"ar-ma\"><b><font size=\"2\">";
//AFFICHAGE DU LIEN PRECEDENT SI BESOIN
if ($page>0)
{
$precedent=$page-1;
print "<a href=\"$script_name?page=$precedent&nachat=$j\">السابق</a> \n";
}
// AFFICHAGE DES NUMEROS DE PAGE
$i=0;$j=1;
if($nb_total>$limit)
{
while($i<($nb_total/$limit))
{
if($i!=$page){echo "<a href=\"$script_name?page=$i&nachat=$j\">$j</a> ";}
else {echo "<font color=\"#111111\">$j</font> ";}
$i++;$j++;
}
}
// AFFICHAGE DU LIEN SUIVANT SI BESOIN
if($debut+$limit<$nb_total)
{
$suivant=$page+1;
echo "<a href=\"$script_name?page=$suivant&nachat=$j\">التالى</a>";
}
echo "</font></b></span></font><HR color=\"#000000\"></p>";?> |
Partager