Probleempje met agenda scriptje
Op http://www.djbjakke.be/agenda.php heb ik een simpel agendascriptje dat oude en nieuwe events uit mekaar haalt en dan ook zo weergeeft, het probleem is dat de events op de dag zelf (TEST EVENT) bij PAST EVENTS komen te staan terwijl die uiteraard nog bij UPCOMING moet komen ...
Iemand een ideetje hoe ik mijn script kan aanpassen om dit te doen werken?
Reeds dank!!!
Code (php)
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
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
<div class="textbox">
<?
////////////// UPCOMING
$query = mysql_query("SELECT * FROM agenda WHERE datagenda >= NOW() ORDER BY datagenda ASC");
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM agenda"),0);
if(!empty($result))
{
while($row = mysql_fetch_assoc($query))
{
?>
<div><b>:: <span class="greydate"><? echo htmlspecialchars($row['datagenda']); ?></span></b> :: <b><? echo htmlspecialchars($row['eventtitel']) ?></b></div>
<?
if(isset($_SESSION['beheerder']))
{
echo "<div align=\"right\">(<a href=\"administratie.php?act=agenda&sub=edit&agenda_id=" . $row['id'] . "\">Edit</a> | <a href=\"javascript:del_agenda('" . $row['id'] . "')\">Delete</a>)</div>";
}
echo "<blockquote>";
echo nl2br($row['info']);
echo "</blockquote><br>";
}
}
else
{
echo "No upcoming events yet.";
}
?>
</div>
<div class="titlebar"><b>:: Past Events</b></div>
<div class="textbox">
<?
////////////// PAST
$query = mysql_query("SELECT * FROM agenda WHERE datagenda < NOW() ORDER BY datagenda DESC");
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM agenda"),0);
if(!empty($result))
{
while($row = mysql_fetch_assoc($query))
{
?>
<div><b>:: <span class="greydate"><? echo htmlspecialchars($row['datagenda']); ?></span></b> :: <b><? echo htmlspecialchars($row['eventtitel']) ?></b></div>
<?
if(isset($_SESSION['beheerder']))
{
echo "<div align=\"right\">(<a href=\"administratie.php?act=agenda&sub=edit&agenda_id=" . $row['id'] . "\">Edit</a> | <a href=\"javascript:del_agenda('" . $row['id'] . "')\">Delete</a>)</div>";
}
echo "<br>";
}
}
else
{
echo "No past events";
}
?>
</div>
<?
////////////// UPCOMING
$query = mysql_query("SELECT * FROM agenda WHERE datagenda >= NOW() ORDER BY datagenda ASC");
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM agenda"),0);
if(!empty($result))
{
while($row = mysql_fetch_assoc($query))
{
?>
<div><b>:: <span class="greydate"><? echo htmlspecialchars($row['datagenda']); ?></span></b> :: <b><? echo htmlspecialchars($row['eventtitel']) ?></b></div>
<?
if(isset($_SESSION['beheerder']))
{
echo "<div align=\"right\">(<a href=\"administratie.php?act=agenda&sub=edit&agenda_id=" . $row['id'] . "\">Edit</a> | <a href=\"javascript:del_agenda('" . $row['id'] . "')\">Delete</a>)</div>";
}
echo "<blockquote>";
echo nl2br($row['info']);
echo "</blockquote><br>";
}
}
else
{
echo "No upcoming events yet.";
}
?>
</div>
<div class="titlebar"><b>:: Past Events</b></div>
<div class="textbox">
<?
////////////// PAST
$query = mysql_query("SELECT * FROM agenda WHERE datagenda < NOW() ORDER BY datagenda DESC");
$result = mysql_result(mysql_query("SELECT COUNT(*) FROM agenda"),0);
if(!empty($result))
{
while($row = mysql_fetch_assoc($query))
{
?>
<div><b>:: <span class="greydate"><? echo htmlspecialchars($row['datagenda']); ?></span></b> :: <b><? echo htmlspecialchars($row['eventtitel']) ?></b></div>
<?
if(isset($_SESSION['beheerder']))
{
echo "<div align=\"right\">(<a href=\"administratie.php?act=agenda&sub=edit&agenda_id=" . $row['id'] . "\">Edit</a> | <a href=\"javascript:del_agenda('" . $row['id'] . "')\">Delete</a>)</div>";
}
echo "<br>";
}
}
else
{
echo "No past events";
}
?>
</div>
NOW() is nu inclusief tijdstip. gebruik CURRENT_DATE()
het werkt! bedankt!