Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh page to update table contents(from MySQL) 1

Status
Not open for further replies.

nataly333

Programmer
Joined
Oct 23, 2003
Messages
11
Location
CA
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
 
Thank You very much!
I tried something like:
<META HTTP-EQUIV=&quot;Refresh&quot; CONTENT=&quot;3;URL=http://www.some.org/some.html&quot;>
but it didn't work.
Even if it work, it work only one time,is in't it?
And i need refresh my page each 60 sec, all the time...
Do you have any idea?
Sorry for my English, and thank you again for help :)
 
I've tried your sudgections

<meta http-equiv=&quot;refresh&quot; content=&quot;60;url=<?php echo $PHP_SELF; ?>&quot;>
<meta http-equiv=&quot;refresh&quot; content=&quot;60;url=<? echo $_SERVER['PHP_SELF'] ?>&quot;>

Unfortunately it doesn't work.
Thank you for your help
 
That's odd. This script:

Code:
<?php
session_start();

if (!array_key_exists('foo', $_SESSION))
{
        $_SESSION['foo'] = 1;
}
else
{
        $_SESSION['foo'] ++;
}

print '<html>
        <head>
                <meta http-equiv=&quot;refresh&quot; content=&quot;10; test_refresh.php&quot;>
        </head>
        <body>
                ';

print $_SESSION['foo'];

print '
        </body>
</html>';
?>

Works for me. Every 10 seconds the page refreshes and the session variable is updated. I'm getting a count of a new number every 10 seconds.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
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...?
I am really in trouble...
 
This is my code:

<?
include(&quot;shared.inc.php&quot;);
global $PHP_SELF;
?>
<html>
<head><title>My Site</title>
<meta http-equil=&quot;refresh&quot; content=&quot;30;url=<? echo $_SERVER['PHP_SELF'] ?>&quot;>
</head>
<body bgcolor=#dfdfdf>
<?
$hostname=&quot;delta&quot;;
$username=&quot;root&quot;;
$password=&quot;nataly789&quot;;
$dbName=&quot;delta&quot;;

$db = mysql_connect($hostname,$username,$password) or die (&quot;Can't connect to database &quot;);

mysql_select_db(&quot;$dbName&quot;,$db) or die(&quot;Can't select database&quot;);

$usertable=&quot;product&quot;;
$result = mysql_query(&quot;SELECT * FROM $usertable&quot;);
$num_rows = mysql_num_rows($result);

while ($myrow = mysql_fetch_array($result))
{
echo &quot;<table width=500 border=0 cellspacing=0 cellpadding=0><tr>
<td>&quot;.$myrow[0].&quot;</td>
<td width=120>&quot;.$myrow[1].&quot;</td>
<td width=120>&quot;.$myrow[2].&quot;</td>
</tr></table>&quot;;
}

mysql_close($db);

?>

</body>
</html>

 
Thank You!
I was stupid and blind...
It is work!
Thank You very much for all your help
Nataly
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top