mysql - setting a php if statement to execute function only once? -


i have table called profile_views on site counts how many times person views users profile. trying let users see how many visiters they've had profile in week, , every week on monday want table emptied count can restart 0.

i trying create php if statement says every week on monday carry out delete mysql query. have got perform if day monday, trying find way execute once, preferably @ 00:00am monday morning, because dont want deleting results in table throughout whole of monday.

<?php $today=date(l); // find today is? using date function  // if today monday displays message "today monday" , displays image1.gif if($today==tuesday) { // compare $today name of day.   $result = mysql_query("delete ptb_profile_views;")  or die(mysql_error());  } ?> 

what looking named cron - use invoke php script on desired weekday @ desired time.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -