Php / MySQL自动日期检查/比较

Wanted to ask You how can I setup something on my php website, that would everyday automatically check and compare current date to all the database datetime entries and delete the rows of the dates that are in the past (for ex. if the current date is 2014-03-17, it would delete the rows that have datetime of 2014-03-16 ). Because I basically have a TV-package website (not a real thing, just for a class), where you can order a package, you enter for how long and it adds that amount to current date, writes the order into database with the date written into a field named "expires". Would it make sense if I just wrote the checking function into the index, so when someone visits the site it would delete it? If so, how could I compare the two dates? The DB example looks something like this: http://s29.postimg.org/7sbgj2hnr/dbtest.png

Although I highly recommend a scheduled task, you can do it in PHP by calling:

$sql = "DELETE FROM tableName WHERE `expires`<'".date('Y-m-d')."'";

Convert the date to a unix timestamp and compare it against the value of time() like you would any other integers.