jrwap
01-14-2002, 09:56 PM
First let me say that my vb has been hacked to allow the use of multiple usergroups in the calendar. Each usergroup has been named new1, new2, new3, .... , new9, and new10. The site uses a small hack that was part of vbportals that displays the current days events on the main page. Now, I want to be able to display the days events listed by usergroup. I can't seem to get it right without a MySQL error. Can anyone help?
Here is the original code which displays the public events:
// Display Today's Event's //
if ($showevents){
$events=$DB_site->query("SELECT eventid, subject, eventdate, public
FROM calendar_events
WHERE eventdate
LIKE '%-$today' AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");
$num_rows = mysql_num_rows($events);
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
while ($event = $DB_site->fetch_array($events)) {
$P_eventsubject = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
}
$eventtitle="Today's Events";
}else{
$eventtitle="";
}
eval("\$P_calendar .= \"".gettemplate('P_calendar')."\";");
}
I tried with this, but it gives me an error:
// Display Today's Event's //
if ($showevents){
$events=$DB_site->query("SELECT eventid, subject, eventdate, public, event_type
FROM calendar_events
WHERE eventdate
LIKE '%-$today' AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");
$num_rows = mysql_num_rows($events);
while ($event = $DB_site->fetch_array($events)) {
if ($event[event_type] == 'new3'){
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
$P_eventsubject3 = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
if ($event[event_type] == 'new4'){
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
// while ($event = $DB_site->fetch_array($events)) {
$P_eventsubject4 = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
}
$eventtitle="Today's Events";
}else{
$eventtitle="";
}
eval("\$P_calendar .= \"".gettemplate('P_calendar')."\";");
}
Can anyone please help me through this.... I don't know MySQL well enough.
Thanks,
-JRW
Here is the original code which displays the public events:
// Display Today's Event's //
if ($showevents){
$events=$DB_site->query("SELECT eventid, subject, eventdate, public
FROM calendar_events
WHERE eventdate
LIKE '%-$today' AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");
$num_rows = mysql_num_rows($events);
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
while ($event = $DB_site->fetch_array($events)) {
$P_eventsubject = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
}
$eventtitle="Today's Events";
}else{
$eventtitle="";
}
eval("\$P_calendar .= \"".gettemplate('P_calendar')."\";");
}
I tried with this, but it gives me an error:
// Display Today's Event's //
if ($showevents){
$events=$DB_site->query("SELECT eventid, subject, eventdate, public, event_type
FROM calendar_events
WHERE eventdate
LIKE '%-$today' AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");
$num_rows = mysql_num_rows($events);
while ($event = $DB_site->fetch_array($events)) {
if ($event[event_type] == 'new3'){
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
$P_eventsubject3 = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
if ($event[event_type] == 'new4'){
if ($num_rows < 1) {
$P_noevents = "None Found";
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}else{
// while ($event = $DB_site->fetch_array($events)) {
$P_eventsubject4 = htmlspecialchars($event[subject]);
$P_eventid = $event[eventid];
eval ("\$todaysevents .= \"".gettemplate("P_todaysevents")."\";");
}
}
$eventtitle="Today's Events";
}else{
$eventtitle="";
}
eval("\$P_calendar .= \"".gettemplate('P_calendar')."\";");
}
Can anyone please help me through this.... I don't know MySQL well enough.
Thanks,
-JRW