01hanstu Posted November 1, 2010 Share Posted November 1, 2010 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 Quote Link to comment Share on other sites More sharing options...
revraz Posted November 1, 2010 Share Posted November 1, 2010 You may have to explain it better. Insert data where? Quote Link to comment Share on other sites More sharing options...
01hanstu Posted November 1, 2010 Author Share Posted November 1, 2010 Hi, Never good at trying to type what I mean :-\ I want it to loop through the monday of each week, until the end of the current year. It will insert data, from a CSV file (I have the code for that) into every monday (start_date) Hope this helps - Stu Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted November 1, 2010 Share Posted November 1, 2010 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); } Quote Link to comment Share on other sites More sharing options...
01hanstu Posted November 1, 2010 Author Share Posted November 1, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.