close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

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 | 1089 views | 7 replies


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.

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");
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

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





Ease of use


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