I have the following code, it is written by someone else, I am trying to modify it for my needs. I cannot get it to connect to the query... this is what I have:
I believe the problem lies here:
where I have it bolded for if I take from the bolded point forward and put it in a popup page triggerred by the on click command and change the bolded line to:
it works....
so what am I doing wrong?
Code:
for ($list_day = 1; $list_day <= $daysinmonth; $list_day++) {
$tm = date("U", mktime(0, 0, 0, $month, $list_day, $year)) - 86400; // Bir gün önce
$tn = date("U", mktime(0, 0, 0, $month, $list_day, $year)); // O gün ...
$tp = date("U", mktime(0, 0, 0, $month, $list_day, $year)) + 86400; // Bir gün sonra
$Q = sprintf("SELECT * FROM `events` WHERE `date` > '%s' AND `date` < '%s' AND `day` = '%s';", $tm, $tp, $list_day);
$R = mysql_query($Q);
$D = mysql_fetch_assoc($R);
$S = mysql_num_rows($R);
$Y = $D['date'];
$TheDay = date('d', $Y);
$TheMon = date('F', $Y);
$TheYea = date('Y', $Y);
mysql_free_result($R);
if ($S) {
?>
<td align="center" onclick="popupEvent(<?php echo $D['day']; ?>, <?php echo $D['month']; ?>, <?php echo $D['year']; ?>, 400, 500)" style="background-color: #CCFF00; color: #333333;cursor: pointer;"
onmouseover="<?PHP echo "return overlib('<table width="100%" border="0" cellpadding="2" cellspacing="0" class="popupDateTable"><tr><td align="center" class="popupDate">" ?> <?php echo $TheDay; ?> <?php echo $TheMon; ?> <?php echo $TheYea; ?><?PHP echo "</td></tr></table>');" ?>[B]<?php while ($D = mysql_fetch_assoc($R)) {?>[/B]<?PHP echo "<br /><div class="popupEventTitle s24">" ?> <?php echo stripslashes($D['title']); ?><?PHP echo "</div>"?><?PHP echo "<div class="popupEventTime">"?><?php echo date("d.m.Y", $D['date']); ?><?PHP echo "</div>"?><?PHP echo "<div class="popupEventDescription">"?><?php echo '@' . stripslashes($D['location']); ?><?PHP echo "</div>"?><?php } ?>"
I believe the problem lies here:
Code:
<?php while ($D = mysql_fetch_assoc($R))
Code:
<?php
$Q = mysql_query(sprintf("SELECT * FROM `events` WHERE `day` = '%s' AND `month` = '%s' AND `year` = '%s';", $_GET['day'], $_GET['month'], $_GET['year']));
while ($D = mysql_fetch_assoc($Q)) {?>
so what am I doing wrong?