Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2005, 07:30 AM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default Javascript & PHP

I want to execute a php function every 10 seconds.
How I can do this?

Pls. some one help me

Best Regard:
Md. Zakir Hossain (Raju)
www.rubd.net
www.xenex.rubd.net
www.forum.rubd.net
__________________
Best Regard:
Md. Zakir Hossain (Raju)

www.rajuru.xenexbd.com - my blog with PHP scripts, PHP Book Review and many more
 
Old February 19th, 2005, 09:18 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Rajuru!!

Why Do you want to php function for every 10 seconds.Offcourse this function will be a part of PHP page,like xyz.php.
Since onec php page is executed on the server,it will send to the Client.You can then use javascript function to get values whtever may be .
I am still confusing every 10 seconds php function()??
Can you give short description for it.

Cheers :)

vinod
 
Old February 19th, 2005, 10:42 AM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

Dear, thanks for quick reply.

I have a php script which displays a random image from a specific folder named rotate.
I just copy a new image to the rotate folder and it is displayed randomly by php script and for that i don't have to change my code. It automatically get the images in rotate folder.

but I want to change the image every 10 or 20 seconds. that's why I want to call rotate.php every 10 seconds

Best Regard:
Md. Zakir Hossain (Raju)
www.rubd.net
www.xenex.rubd.net
www.forum.rubd.net
 
Old February 19th, 2005, 03:04 PM
Authorized User
 
Join Date: Jan 2005
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

how about letting javascript do this for you.

I think there is a settimeout function in javascript that you can use. I am not sure about the syntax, but you can do a recursive function that would call itself every 10 seconds. something like this:

var pic = some random image;
function changepic(){

 pic = (do random code here)
 settimeout(changepic(),10)
 return pic;
}



----------------
Never bother to learn something not knowing which does not do you any harm, and never neglect to learn something whose negligence will increase your ignorance - Imam Jafar Sadeq
 
Old February 19th, 2005, 05:34 PM
Authorized User
 
Join Date: Apr 2004
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can use Inline Frame in HTML, to execute PHP (dynamic page) repeatly.

Like this:

<iframe src="mypage.php" name="ImageFrame">
</iframe>


Place this frame at image position.

From Burhan Khan

 
Old February 22nd, 2005, 12:40 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Rajuru!!

Alternatively you can just do swapping of images on the client side.
Since there is no redirection every time hitting the server :)


Cheers :)

vinod
 
Old February 22nd, 2005, 06:15 AM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

thanks to all

I tried but failed using Javascript and at last I used inline frame.


Best Regard:
Md. Zakir Hossain (Raju)
www.rubd.net
www.xenex.rubd.net
www.forum.rubd.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP & Javascript ketki Pro PHP 2 January 18th, 2007 03:45 PM
PHP & JavaScript variables? mlewitz Beginning PHP 2 December 2nd, 2005 08:18 AM
PHP & JavaScript variables? mlewitz PHP Databases 2 November 30th, 2005 10:16 PM
Javascript && keeps turnig into &amp;&amp; ayrton Pro VB.NET 2002/2003 3 June 27th, 2005 03:34 PM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.