Jump to content

Basic Event Calendar:Obsidians tutorial


swatisonee

Recommended Posts

Hi,


I found this tutorial a great help and was able to tweak it *somewhat* to my specific needs which is that i want different users to be able to add events.

I was able to code this without a problem but when i want to view the events, i'm only able to view events where userid is null but not the ones listed by the specific users. userid is a varchar field, with default as null
[table][tr][td]
userid       title                   event_date
  null        xmas                  2006-12-25
1            moms birthday      2006-12-25

[/table]

So, using the above example, only xmas can be viewed but not moms birthday.

This is the snippet where i'm facing the problem so would anyone be able to guide me on this ?


[code]$userid = $_GET["userid"];
//echo $userid; echoes correctly . But when a date other than current date is chosen, this is blank.

// Calendar is done, let's list events for selected day
$sql = mysql_query("SELECT * FROM Events WHERE event_date = '$year-$month-$day' AND (Userid = '$userid' || Userid = 'null ') ");
if (mysql_num_rows($sql) > 0) {


  while ($e = mysql_fetch_array($sql)) {


     echo "<font face=Tahoma size=2 color=#F5BB32><b>Events for ";
  echo  $day ;  echo "  "; echo $month; echo "  "; echo $year;
  echo " : " ;


  echo    "<p>$e[title]</p>\n";
  echo    "<p>$e[desc]</p>\n";

   }
}


else {
   echo "<p>Select a day for which events have already been recorded.</p>\n";
}

?>[/code]


Thanks ! Swati
Link to comment
https://forums.phpfreaks.com/topic/30216-basic-event-calendarobsidians-tutorial/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.