Getting the next date of a day in MySQL database (PHP)

I have a series of weekly events in a database along with the day they happen on (in full form, so: 'Monday', 'Tuesday' etc). I've successfully printed the events in a while loop ordered by today, tomorrow, etc, but I'd like to put the date in brackets next to each one.

I thought it might be a case of (mock code):

$today = date("l");
$todays_date = date("j M");

if (day == $today) {
    $date = $todays_date;
    }

else if (day == $today + 1) {
    $date = $todays_date + 1;
    }

else if (day == $today + 2) {
    $date = $todays_date + 2;
    }

etc...

But I'm not so sure. It'd be ideal if I could just have the date in the database, but this seems to go against the grain of what MySQL is about.

Also, I'd like to ideally format the date as: 11 Jun.

EDIT

Presumably it's also got to fit into my while loop somehow:

if($result && mysql_num_rows($result) > 0) { 
    while ($row = mysql_fetch_array($result)) { 
        $items[] = array($row[0]);
        echo "<option>" . $row[0] . "</option>";
        }         
}

Answers


You can use strtotime?

echo "Today: ".date("j M");
echo "Tomorrow: ".date("j M", strotime("+1 day"));

You can use strtotime:

echo strtotime("+1 day");

Need Your Help

Toggle behaviour while using window.scroll()

javascript jquery scroll

I am trying to achieve this, when the user is scrolling-disable one element. When the user is not scrolling, revert the element to original state.

Changing an assembly's manifest without re-building

.net assemblies manifest

In .NET, is there a tool or some other method which would allow us to modify an assembly's manifest, without having to modify the AssemblyInfo and re-build the assembly?