Setup cron job on local server

Go to Startmenu->All Programs->Accessories->System Tools->Task Scheduler->create Task

In the new window we having 4 options

1. General (Give the Task name and for testing you can select “Run when User is logged in“)

2. Trigger (You can Select the running interval as “daily,weekly,monthly”. )

3. Action (This is most important part.Select a Mozilla firefox as the “program/script” and in the Argument provide the URL to fire with Mozilla firefox like http://www.waytocode.com/mycron.php).

To DO:
Create a task give Running time in Trigger setting.Then in Action setting option in the “Program/Script” command textbox type
C:\xampp\php\php.exe
and in the “Add arguments (optional)” type
-f c:/xampp/htdocs/mycron.php

Advertisements

How to sort ID due to where clause used with IN(..)

SELECT *
FROM `question`
WHERE `id`
IN ( 9, 11, 175, 16 )

The results will be displayed where ids are 9, 11, 175, 16, but the results will be asc by id(9,11,16,175). If you don’t want to use automatic sorting or just list according to 9,11,175,16 add ORDER BY FIELD.

SELECT *
FROM `question`
WHERE `id`
IN ( 9, 11, 175, 16 )
ORDER BY FIELD( id, 9, 11, 175, 16)