refresh page to update table contents (from MySQL)

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

nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

refresh page to update table contents (from MySQL)

Post by nataly333 »

:cry:
I fill my table from MySQL tables. Each 1 minute i need to update table contents according to the changes in database(made by another people)
Can i do it in php? And how?
Thank you for any help
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

You'll need to use JavaScript (or something similar) to refresh the browser page, PHP can't do anything with the browser.
CMaLLeTTe
Forum Newbie
Posts: 4
Joined: Thu Oct 23, 2003 5:14 pm

Post by CMaLLeTTe »

Use a meta refresh tag and make it refresh every 60 seconds
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

Thank You very much.
To CMaLLeTTe :
Can you write a code, please ?
I can't found any example
Thank You again
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

Here you go Nataly, enjoy. :)

Code: Select all

<meta http-equiv="refresh" content="60;url=<?php echo $PHP_SELF; ?>">
Notice the 60; you can change that to anything you like (in seconds)
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

To evilmonkey :
Thank You - Thank You - Thank You !
I do both errors, that means i am a real programmer.
Best regards
Nataly
User avatar
evilmonkey
Forum Regular
Posts: 823
Joined: Sun Oct 06, 2002 1:24 pm
Location: Toronto, Canada

Post by evilmonkey »

LOL :lol:

Best of luck to you.
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

:?
Doesn't refresh, why?
May be i need some condition ?
Sorry for disturbing, i am really in trouble...
Thank You :P
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Try this........

Code: Select all

<meta http-equiv="refresh" content="60;url=<? echo $_SERVER&#1111;'PHP_SELF'] ?>">
...........have fun.

Don't forget the code needs to go inside your webpage <head> (in here) </head> tags.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

it works inside the body tags

its supposed to go in the head, but i find it usually needs to go in the body tag.. and it always works
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

To Gen-ik :
It doesn't works , maybe I need to define something in php.ini ?
Thank you for your help


To LiLpunkSkateR :
It doesn't works not in body tag and not in head tag.What do you think is
a problem ?
Thank you
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

LiLpunkSkateR wrote:it works inside the body tags

its supposed to go in the head, but i find it usually needs to go in the body tag.. and it always works
Yes it might work if it goes in the <body> of the page but all meta tags should be placed in the <head> of the page. <meta name="keywords" | <meta name="description | ....... and so on all need to be placed in the page <head>

It's standard practice.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

nataly333 wrote:To Gen-ik :
It doesn't works , maybe I need to define something in php.ini ?
Thank you for your help


To LiLpunkSkateR :
It doesn't works not in body tag and not in head tag.What do you think is
a problem ?
Thank you
Oooh!. Don't forget that (a) your webpage with any PHP in it needs to have a .php extension ( mypage.php for example )... and PHP will only work when it is on-line, it won't work if the PHP page is sitting on your computer... unless your computer is setup as a server.
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

Of course have a .php extension file. One my computer is setup as a server, and second as a client. All another things are working well : connection to MySQL, tables filling...
Only refreshing doesn't work.
That's very odd. It supposed to work, but it doesn't:(
Is it depends on browser?
I remember that it worked. I reinstall php and MySQL, and it stoped to work.
But that is stupid: this is only html tag...?
nataly333
Forum Newbie
Posts: 17
Joined: Thu Oct 23, 2003 4:08 pm

Post by nataly333 »

Previous post was for Gen-ik.
Thank You for help and attention.
Post Reply