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
| function tab_out($result) {
$nombre=mysql_num_fields($result);
echo "<table width=90% border=0 align='center' cellpadding='2' cellspacing='2'>";
echo "<tr bgcolor=#FFEFBF>";
for ($i=0;$i<$nombre;$i++) {
echo "<th>";
echo mysql_field_name($result,$i);
echo "</th>";
}
echo "</tr>";
echo "<tr>";
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$couleur = 1;
foreach ($row as $elem) {
if ($couleur == 1) {
echo "<td bgcolor='#A6C8C8'><div align='center'><font size='-1'>$elem</font></div></td>";
$couleur = 2;
} else {
echo "<td bgcolor='#B99CA3'><div align='center'><font size='-1'>$elem</font></div></td>";
$couleur = 1;
}
}
echo "</tr>";
}
echo "</table>";
}
/*************************************************************
************ creation du rapport ****************
*************************************************************/
$lk=connect();
$db="projet";
$sql="SELECT*FROM agenda ORDER BY client_visite";
If ($result=mysql_db_query($db,$sql)) {
echo"<div align='center'><font size='+1'>Liste des rendez-vous</font></div><br>";
tab_out($result);
} else {
echo "la commande SQL n'a pas pu être exécutée.";
} |
Partager