Merci beaucoup pour les liens!
Voilà donc ce que j'ai bricolé:
<?php
// constante
define ('C_open_tr_td', '<tr><td height="20" valign="top">');
define ('C_top_line','<img src="img/hours_fd_clair.gif" align="absmiddle">
<font face=tahoma size=1>');
define ('C_no_line','<img src="img/hours_fd_trans.gif" width="6" height="20" align="absmiddle">');
define ('C_close_td_tr', '</td></tr>');
// début du tableau
echo '<table width="550" border="0" cellpadding="0" cellspacing="0" background="img/hours_fd.gif">'."n";
echo '
<tr>'."n".'
<td width="48" rowspan="23" valign="top"><img src="img/hours.gif" width="48" height="457"></td>'."n".'
<td width="550" height="17" valign="top"><img src="img/hours_fd_trans.gif" width="1" height="17"></td>
</tr>'."n";
$h1 = array("900","930","1000","1030","1100","1130",
"1200","1230","1300","1330","1400",
"1430","1500","1530","1600","1630",
"1700","1730","1800","1830","1900");
$h2 = array("930","1000","1030","1100","1130","1200",
"1230","1300","1330","1400","1430","1500",
"1530","1600","1630","1700","1730","1800",
"1830","1900","1930");
$k = key($h1);
$k2 = key($h2);
$val = current($h1);
$val2 = current($h2);
reset($h1);
reset($h2);
// requetes sql pour afficher les évènements dans le calendrier ce jour
$sql_evnt='SELECT id FROM cal_evnt WHERE date="'.$date_corrig.'"';
if($p = @mysql_query($sql_evnt,$c))
{
while ($row = mysql_fetch_array($p))
{
while(list ($k, $val) = each ($h1) AND list ($k2, $val2) = each ($h2))
{
echo C_open_tr_td;
$sql_evnt_heures='SELECT id,titre, heure FROM cal_evnt WHERE date="'.$date_corrig.'" AND heure>="'.$val.'" AND heure<"'.$val2.'"<br>';
if($p2 = @mysql_query($sql_evnt_heures,$c))
{
while ($r = mysql_fetch_array($p2))
{
echo C_top_line."n";
echo rect($r['heure'])."n";
echo $r["titre"]."n";
echo '</font>';
}
}
else
{
echo C_no_line;
}
}
}
}
echo '</table>'."n";
?>
Le problème c'est que cela ne me renvoit aucuns résultats. Ce fichier est en include. Le problème ne vient pas de la connection à la bdd, ni des données stockées dans la bdd... Je ne vois pas ou ça foire?
Avez-vous une idée? |