Yes, that's a good approach, although it is MySQL specific. If you ever change the DB, your code will probably break. Note an issue though, it's probably not going to happen :)
Just to answer your original question:
It doesn't work because you compare a UNIX timestamp to a MySQL Date field. Either you first format the $lastweek timestamp as SQL Date and then use it in the query, or you use [url=http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime]FROM_UNIXTIME(timestamp)[/url] in your query (which is most likely MySQL only again).