close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

MySQLi while loop for recurring event calendar

Thread began 8/21/2014 3:13 pm by Jason | Last modified 9/02/2014 8:24 pm by Jason | 777 views | 7 replies |

Jason

MySQLi while loop for recurring event calendar

Hey Jason,
I'm still working on the same page kids_insert_shift_recurring.php, but now I'm trying to get my insert to work correctly.
What I'm going for here is to have the insert behavior write 1 row for every time the event would occur into the kids_programs_shifts table of my database and then stop after 1 year of events have been written.

For example if I created a recurring event for Jan 1st and said it should recur every month on the 1st day. When I hit submit it should write 11 or 12 (not sure if it's going to count the originally created event or overwrite it) events into the kids_program_shifts table and then stop.

Here's what I got so far, but I ain't having much luck.

<?php
if ((((isset($_POST["Submit"]))?$_POST["Submit"]:"") != "")) {
$next_event = strtotime($_GET["Frequency"].' '.$_GET["RecurType"].' FROM '.$_POST["RecurStart"]);

while(date('Y-m-d', $next_event)<strtotime('1 year from '.$_POST["RecurStart"]) && date('Y-m-d', $next_event)<strtotime($_POST["RecurEnd"])){

$InsertQuery = new WA_MySQLi_Query($local_i);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "kids_program_shifts";
$InsertQuery->bindColumn("kids_program_date", "t", "".((isset($next_event))?$next_event:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("");
$InsertQuery->execute();
echo $InsertQuery->Statement;
$InsertGoTo = "";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
// $InsertQuery->redirect($InsertGoTo);
$next_event = strtotime($_POST["Frequency"].' '.$_POST["RecurType"].' FROM '.$next_event);
}
}
?>
Attached Files
kids_insert_shift_recurring.php
Sign in to reply to this post

Jason ByrnesWebAssist

This is more advanced custom coding than i can help with here in the forum, you should sign up for a premiere support appointment where we can work with you in a one on one session:
http://www.webassist.com/premier_request.php

Sign in to reply to this post

Jason

Yeah I was afraid of that. No room in the budget for it at the moment. I'll try to keep plugging away at it for now. Thanks anyway!

Sign in to reply to this post

Jason

Hey Jason,

I know you said I was going to have to submit a premier support ticket for help with the recurring events calendar, but I think I've figured it out except I'm having one last issue. I'd love to post a working generic version of all the files to the forum when I'm done for others to use. The last issue doesn't really have anything to do with your products, but it does seem to be a simple php problem. I've had a lot of help from people I know here to get this far, but everyone seems to be stumped on this and I thought you might be willing to take a look and work your magic if I published a complete working version to the forums since I've seen a lot of request for it in the past.

The calendar is on the index page and on line 39 it gets the event data from the events page. If you view the source of events.php it's putting out the correct data string, however the calendar on index.php only displays the first event in each recurring event. The really strange thing is the if I copy the source output of events.php and paste it at the end of the events.php source code (and comment out the render_fccalendar_events(); function), the calendar displays the recurring events correctly. From what I can see it's the index page is getting exactly the same string either way, but obviously something is different.

If you're not able to provide support on this issue I completely understand. Just thought I'd ask.

Attached Files
events.php
index.php
Sign in to reply to this post

Jason ByrnesWebAssist

i'm not sure, rely, this is beyond what I can offer support for.

however, looking at the source of events.php, it looks like the first 2 event gets ID 1, then each one after it gets ID 2:


[{"id":"1","title":"92575","start":"2014-08-01","end":"2014-08-01","allDay":"","editable":"1","repeat_i":"1","repeat_f":"3","repeat_e":"2023-04-13"},{"id":"1","title":"77727","start":"2014-08-22","end":"2014-08-22","allDay":"","editable":"1","repeat_i":"1","repeat_f":"3","repeat_e":"2023-04-13"},{"id":"2","title":"51794","start":"2014-08-04","end":"2014-08-04","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"82558","start":"2014-08-06","end":"2014-08-06","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"86149","start":"2014-08-08","end":"2014-08-08","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"28106","start":"2014-08-10","end":"2014-08-10","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"49485","start":"2014-08-12","end":"2014-08-12","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"65132","start":"2014-08-14","end":"2014-08-14","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"11004","start":"2014-08-16","end":"2014-08-16","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"37249","start":"2014-08-18","end":"2014-08-18","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"67753","start":"2014-08-20","end":"2014-08-20","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"56621","start":"2014-08-22","end":"2014-08-22","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"25915","start":"2014-08-24","end":"2014-08-24","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"43782","start":"2014-08-26","end":"2014-08-26","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"},{"id":"2","title":"72648","start":"2014-08-28","end":"2014-08-28","allDay":"","editable":"1","repeat_i":"0","repeat_f":"2","repeat_e":"2023-04-13"}]


seams to me that each event should get a unique ID, no?

Sign in to reply to this post

Jason

No, according to the fullcalendar documentation recurring events all need to have the same ID. I went down that path myself though, and manually set the id's. It didn't change anything. Check these 2 pages all I did was copy the output of events.php and pasted it at the bottom of the source code (essentially feeding index.php the same info), but this time the calendar displays the correct information. I changed the date on these to Sept, but just because I got tire of clicking back to August. I produced the same result as when they were August though.

Attached Files
events2.php
index2.php
Sign in to reply to this post

Jason ByrnesWebAssist

It's not a package i am familiar with, so really cant offer support.

Sign in to reply to this post

Jason

Ok. Thanks for taking a look anyway!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...