Hi,
Is it possible to call a function every 'x' amount of seconds like javascript's setTimeout("functionToCall()",10000); function??
Thanks Guys :-0
(RESOLVED) call php function every 'x' amount of seconds
Moderator: General Moderators
(RESOLVED) call php function every 'x' amount of seconds
Last edited by hairytea on Wed Feb 24, 2010 9:34 am, edited 1 time in total.
Re: call php function every 'x' amount of seconds
You can use tick
But the timing should be implement by you, since you can not specify number of seconds
you can use a while() which tracks time and call functions every x seconds
it hardly depends on what you want to do.
But the timing should be implement by you, since you can not specify number of seconds
you can use a while() which tracks time and call functions every x seconds
it hardly depends on what you want to do.
Re: (RESOLVED) call php function every 'x' amount of seconds
I have made a javascript workaround...
Code: Select all
<script type="text/javascript">
<!--
function ranImage() {
images1 = new Array();
images1[0]="<img src='images/<?php echo $imageOne; ?>' alt='<?php echo $resort_name; ?>, <?php echo $actual_country; ?>' title='<?php echo $resort_name; ?>, <?php echo $actual_country;?>' border='2' width='500' height='291' />";
images1[1]="<img src='images/<?php echo $imageTwo; ?>' alt='<?php echo $resort_name; ?>, <?php echo $actual_country; ?>' title='<?php echo $resort_name; ?>, <?php echo $actual_country;?>' border='2' width='500' height='291' />";
images1[2]="<img src='images/<?php echo $imageThree; ?>' alt='<?php echo $resort_name; ?>, <?php echo $actual_country; ?>' title='<?php echo $resort_name; ?>, <?php echo $actual_country;?>' border='2' width='500' height='291' />";
images1[3]="<img src='images/<?php echo $imageFour; ?>' alt='<?php echo $resort_name; ?>, <?php echo $actual_country; ?>' title='<?php echo $resort_name; ?>, <?php echo $actual_country;?>' border='2' width='500' height='291' />";
images1[4]="<img src='images/<?php echo $imageFive; ?>' alt='<?php echo $resort_name; ?>, <?php echo $actual_country; ?>' title='<?php echo $resort_name; ?>, <?php echo $actual_country;?>' border='2' width='500' height='291' />";
index1 = Math.floor(Math.random() * images1.length);
document.getElementById('piccy').innerHTML = images1[index1];
setTimeout("ranImage()",4000);
}
//-->
</script>