Jump to content

PHP Loop Help!


01hanstu

Recommended Posts

Hi,

I am trying to create a loop as such so that when I load the script it will check for the date in the 'start_date' field, normally formatted by the date(Y-M-D) function, but I need it to loop until the end of the current year and insert data too.

Please Advise,

- Stuart

Link to comment
Share on other sites

I don't understand about the CSV, but here you get an array of Mondays from today until the end of the year:

 

$start = time(); //or whenever you want

for($date=$start; date('Y', $date)==date('Y', $start); $date=strtotime('next monday', $date)) {
$mondays[] = date('Y-m-d', $date);
}

Link to comment
Share on other sites

Hi,

The CSV holds the data, that gets exported from another system. I am importing it into the database, and within the DB it has a table called timetable, with a structure of the following

 

| Start_date | MON | TUE | WED | THU | FRI |

 

Then the script will open up week based on the start date, and then it can be used by the app.

The app is a custom calendar.

 

Sorry if I havn't explained it properly.

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.