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
example of event to fetch the data from a table on every 5
Moderator: General Moderators
- 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
You have to wrap you query in mysql_query(), then see if the query is successful
Once that is achieved use a function like mysql_fetch_array() and use a while loop to display the information to the browser.
Code: Select all
<?php if ($query) ?>“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
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.
- How to fetch the data: take a look at mysql_ functions.
- How to run the script every one hour: use cron jobs.