Jump to content

Event Calendar


outsider_child

Recommended Posts

I got this Event Calendar Script off of a site and i like it but it reads from a Flat File Database and i would like it to read from a mysql database. Can someone help me set it up so it will read from a mysql database? here is the script where its calling from the flat file..

 

   $counterfilepath="calendar.txt";
   if(file_exists($counterfilepath)) 
   {
    $filehandle=fopen($counterfilepath,"r");   
    $pointer = 1;
    while(!feof($filehandle))
    {
     $rowdata = fgets($filehandle);
     $day = floatval(substr($rowdata,3,2));
     $eventlastpos = strpos($rowdata,'{')-1;
     if($eventlastpos<=0){$eventlastpos=255;}
     $event = rtrim(substr($rowdata,11,$eventlastpos-10));
     $eventcaption = rtrim(substr($rowdata,$eventlastpos+2,strlen($rowdata)));
     $datalist = $this->eventsthismonth[$day];
     $rowmonth = floatval(substr($rowdata,0,2));
     $rowyear = floatval(substr($rowdata,6,4));

     if($rowmonth==$month and $rowyear==$year)
     {
     if($eventcaption=="")
       {$eventcaption='';} 
     else
       {$eventcaption='<b>'.$eventcaption.'</b><br>';}  
    
     if($datalist=="") 
       {
        $this->eventsthismonth[$day] = '<font name=Verdana size=1>'.$eventcaption.$event.'</font>';
       }
     else
       {
        $this->eventsthismonth[$day] = $datalist.'<br><hr size=1 color=#E0E0E0><font name=Verdana size=1>'.$eventcaption.$event.'</font>';
       }
     }	
     $pointer = $pointer + 1;	
    }	
    fclose($filehandle);
   }

 

and the flat file looks like this

07/13/2005|Technology Advisory Meeting{2:00pm

Link to comment
https://forums.phpfreaks.com/topic/234891-event-calendar/
Share on other sites

i understand them its just i never converted flat file databases to mysql database and i am asking for help not for someone to write the script. i can do the sql part its just not sure which parts i need to take out and stuff.

 

here is what im not really figuring out..

 

$day = floatval(substr($rowdata,3,2));

 

what is 3,2 for?

Link to comment
https://forums.phpfreaks.com/topic/234891-event-calendar/#findComment-1207110
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.