example of event to fetch the data from a table on every 5

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kaif
Forum Newbie
Posts: 12
Joined: Thu Jan 06, 2011 11:12 pm

example of event to fetch the data from a table on every 5

Post by kaif »

I created the event for the select query, it successfully running on mysql.I have the problem that how to run this on the window for every 1 hour.

this is my code:

event CREATE EVENT `kaif`
ON SCHEDULE EVERY 5 SECOND
do
SELECT * FROM test.temp2;

this code is running successfully on mysql but how to retrive (fetch) the result and display on the browser

please give me the solution

Thanks in advance from Kaif
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: example of event to fetch the data from a table on every

Post by social_experiment »

You have to wrap you query in mysql_query(), then see if the query is successful

Code: Select all

<?php if ($query) ?>
Once that is achieved use a function like mysql_fetch_array() and use a while loop to display the information to the browser.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Phoenixheart
Forum Contributor
Posts: 123
Joined: Tue Nov 16, 2004 7:46 am
Contact:

Re: example of event to fetch the data from a table on every

Post by Phoenixheart »

There are 2 questions here:

- How to fetch the data: take a look at mysql_ functions.
- How to run the script every one hour: use cron jobs.
Post Reply