0

Let I have a table as the following...

-----------------------------
| id    |  questions  | type |
------------------------------

Based on server time I want to pick 5 random rows from this table and place those into another table.And I want this to happen after every 15 minutes of the server time. I am using php mySql. How this can be done. Is there any way so that it will run in localhost (I am using windows) and linux server. If anybody of you have the idea please help me. Thanx

1
  • Sounds like you could use cronjobs Commented Dec 2, 2013 at 14:08

2 Answers 2

3

Assuming you have linux server and cronjob installed:

STEP 1: Open a Terminal Window

Once you have opened a terminal window, type in the following...

crontab -e

STEP 2: Add a cron job

At the end of the file paste one of the following to have your cron job run...

Every Minute:

* * * * * /path/to/php -f /absolute/path/to/script.php 

Every Five Minutes:

*/5 * * * * /path/to/php -f /absolute/path/to/script.php 

Every Hour:

0 * * * * /path/to/php -f /absolute/path/to/script.php 

Every Five Hours:

0 */5 * * * /path/to/php -f /absolute/path/to/script.php 

STEP 3: Save

And in your php file you can do those manipulations you stated as you wish

Sign up to request clarification or add additional context in comments.

Comments

0

You need a scheduler. You can write a PHP script to program your requirement. Since you are running Windows, start your Windows Task Scheduler, add your script as the action.

If you were running Linux, you would be doing what @Vit Kos noted above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.