While loop

Hello everyone I would need help with the while function.

here it is for a duplication of event, I have a start date, an end date, as long as the end date is not exceeded I want to do an insert in my database. I thought to use a global variable, put the start date, in the while do a comparison, (I do not know if a simple operation is enough to compare two dates or if it is necessary to make a difference then put less than 0)
after the insert I increment my start date by a variable (example 7 days).

my problem is I have an error that I think is related to the starting value
\/dmxConnectLib\/lib\/formatters\/date.php","line":43,"message":"DateTime::__construct(): Failed to parse time string (10000-01-03T09:33:08) at position 11 (T): Double time specification","trace":"#0

/dmxConnectLib\/lib\/formatters\/date.php(43): DateTime->__construct('10000-01-03T09:...')\n#1 [internal function]: lib\\core\\formatter_dateAdd('10000-01-03T09:...', 'days', '7')\n#2

thanks for your help

i found old example, i ll try

1 Like

Curiosity here - why do a "while" instead of a condition. enddate < now then... else...

Hi,
because there is no loop it will only run once, and I want it to run until the date is reached

1 Like