Archive for January, 2012

MySQL SELECT rows In a Date Range

by on Monday, January 16th, 2012

select * from  table
where  date  >= [start date] and date <= [end date]

 select * from  table
where date  between [start date] and [end date]

Cron Job command

by on Monday, January 16th, 2012

command for cron job:

php /home/USERNAME(like redsol)/public_html/wardrobeManagement/demo_cron.php

components of cron:

1: Path to your php or cgi script
2: minutes (Value is 00 – 59. exact minute the cron executes)
3: hour (Value is 00 – 23. hour of the day the cron executes. 0 means midnight)
4: month (Value is 01 – 12. month of the year the cron executes)
5: day (Value is 01 – 31. day of the month the cron executes)
6: weekday (Value is 00 – 06. day of the week the cron executes. Sunday=0,Monday=1…)

Examples on how to set up cron:

If you want to run this file each night at 11.30 PM every day:

30 23 * * * /home/username/www/members.php
30 – represents the minute of cron work
23 – represents the hour of the day
The * represent every day, month, and weekday.

If you want to set the cron job every sunday at midnight 11.30 PM:

30 23 * * 0 /home/username/www/members.php
0 – represents the Sunday.

If you want the cron job to run at 1:00 and 2:00 A.M:

* 1,2 * * * /home/username/www/members.php
This runs your cron at 1A.M and 2A.M every day, every month and every week.

If you want to run the above task only from Monday to Friday and at 11.30 P.M:

30 23 * * 1-5 /home/username/www/members.php
This runs your cron from Monday to Friday and everyday at 11.30 PM.