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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.