Question: I have recently published my website on Hostgator and I have a problem with the sessions.
I have a session start on multiple pages: config.php, login.php, logout.php, index.php.

I have tried everything out there in with checking the whitespace, adding to the .httpaccess file, adding @ob\_start()...and nothing seems to work.
In the error.log I have the following error:

> 
> PHP Warning: session\_start(): Cannot start session when headers
> already sent in ../config.php on line 3
> 
> 
> 

Can you please help me?

Answer: 
It seems strange to say that all months have 30 days. But if you are assuming that you need to recalculate all columns. In this case, revert to days and recalculate everything:

```
select t.*,
       mod(x.total_days, 30) as days,
       floor(mod(x.total_days, 360) / 30) as months,
       floor(mod(x.total_days / 360)) as years
from t cross join lateral
     (select t.days + t.months * 30 + t.years * 360 as total_days
      from dual
     ) x;

```

Note that this handles the case where you have 0/11/39.

If you want this in an `update`, you should be able to use a subquery:

```
update (select t.*, t.days + t.months * 30 + t.years * 360 as total_days
        from t
       ) 
    set days = total_days, 30),
        months = floor(mod(total_days, 360) / 30),
        years = floor(mod(x.total_days / 360));

```

Assuming that a month has 30 days and (hence) that a year has 360 days seems problematic, but that is another issue entirely.
Try this. However, I think it should be 1 year, 3 months and 9 days though, Kindly let me know otherwise.

```
UPDATE your_table
SET
    days = days - 30,
    months = months + 1
WHERE
    days > 30;

COMMIT;

UPDATE your_table
SET
    months = months - 12,
    years = years + 1
WHERE
    months > 12;

COMMIT;

```

Output:

```
Empno Empname Years Months Days
-------------------------------
  111   Ahmed      1     3    9

```