[PHP] Auto refresh when data changed in Mysql
I have made a php + mysql site and hosting in my own IIS server, but in my school network, The page didnt change when i changed the data in mysql server. I think is the cache problem, but i cant fix it even i tick the Update the page everytime when page load in IE. There is no such problem in any home pc. but only in my school's pcs but when i type in www..com/showdata.php then the page can be update. Is there any code or setting can be set to over come this problem? Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto refresh when data changed in Mysql
You could use Headers to tell the browser to expire the page now.. header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); something like that should do it.. See if it works now.. - Original Message - From: Simonk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, April 28, 2002 7:50 PM Subject: [PHP] Auto refresh when data changed in Mysql I have made a php + mysql site and hosting in my own IIS server, but in my school network, The page didnt change when i changed the data in mysql server. I think is the cache problem, but i cant fix it even i tick the Update the page everytime when page load in IE. There is no such problem in any home pc. but only in my school's pcs but when i type in www..com/showdata.php then the page can be update. Is there any code or setting can be set to over come this problem? Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto refresh when data changed in Mysql
I have added the code, but it turn out : Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 6 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 7 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 9 Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 10 Equipments' Detail:- I have tried to put the code in / before the head, but it still cant work properly why? Here is my full HTML code: html head titleEquipments' Detail/title head STYLE body {scrollbar-face-color : #9ca6a5 ; scrollbar-shadow-color : #eaebcf ; scrollbar-darkshadow-color : #eaebcf ; scrollbar-highlight-color : #eaebcf ; scrollbar-3dlight-color : #eaebcf ; scrollbar-track-color : #eaebcf ; scrollbar-arrow-color : black} /STYLE meta http-equiv=Content-Type content=text/html; charset=big5 /head body bgcolor=#FF text=#00 link=#00 vlink=#00 alink=#00 font face=Verdana, Arial, Helvetica, sans-serif size=2Equipments' Detail/font:- div align=right font face=Verdana, Arial, Helvetica, sans-serif size=1A = Available H = Hall N = Not in Hall/font ? header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); mysql_connect (localhost, Administrator); mysql_select_db(Hospital); $sql = select * from equipment; $row = mysql_query($sql); ?table width=80% border=1 cellpadding=0 align=center cellspacing=2 bordercolor=#CC /div tr bgcolor=#e5e5e5 ? while ($head = mysql_fetch_field($row)) { echo TDBfont color=#66 size=2 align=center face=Verdana$head-name/font/B/TD; } echo /TR; while ($field = mysql_fetch_row($row)) { echo TR; for ($i = 0; $i = count($field) - 1; $i++) { echo TDfont size=2 face=verdana$field[$i]/font/TD; }echo /TR; } echo /table; if (!$row) echo Failed; else { $num = mysql_num_rows($row); echofont size=1equipment database has got $num data./font; } ? /font form name=form1 method=post action=find_equipment.php font face=Verdana size=1Search individual equipment:/font INPUT onBlur=this.style.backgroundColor='#ff' onFocus=this.style.backgroundColor='#cc' onMouseOver=this.focus() style=font-size:8pt;BACKGROUND-COLOR:#ff; BORDER-BOTTOM: #11 1px dotted; BORDER-COLLAPSE: collapse; BORDER-LEFT: #11 1px dotted; BORDER-RIGHT: #11 1px dotted; BORDER-TOP: #11 1px dotted maxLength=16 name=equipment size=12 type=text input type=submit name=Submit value=Find /form tr bgcolor=#00 p/p font size=1 face=Verdana, Arial, Helvetica, sans-serifa href=menu.htmlMain Menu/a/fontfont size=2 a href=loaned_equipment.phpfont size=1 face=Verdana, Arial, Helvetica, sans-serifLoaned Equipments/font/a/font a href=equipment_add.htmlfont face=Verdana, Arial, Helvetica, sans-serif size=1Add New Equipment /font/a tr bgcolor=#00 /body /html The_radix [EMAIL PROTECTED] wrote in message 000501c08528$6d880270$3300a8c0@oracle">news:000501c08528$6d880270$3300a8c0@oracle... You could use Headers to tell the browser to expire the page now.. header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); something like that should do it.. See if it works now.. - Original Message - From: Simonk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, April 28, 2002 7:50 PM Subject: [PHP] Auto refresh when data changed in Mysql I have made a php + mysql site and hosting in my own IIS server, but in my school network, The page didnt change when i changed the data in mysql server. I think is the cache problem, but i cant fix it even i tick the Update the page everytime when page load in IE. There is no such problem in any home pc. but only in my school's pcs but when i type in www..com/showdata.php then the page can be update. Is there any code or setting can be set to over come this problem? Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Auto refresh when data changed in Mysql
All header calls need to be made before any content is sent back to the browser. Try this... -- BEGIN CODE -- ?php header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); ? html head titleEquipments' Detail/title head STYLE body {scrollbar-face-color : #9ca6a5 ; scrollbar-shadow-color : #eaebcf ; scrollbar-darkshadow-color : #eaebcf ; scrollbar-highlight-color : #eaebcf ; scrollbar-3dlight-color : #eaebcf ; scrollbar-track-color : #eaebcf ; scrollbar-arrow-color : black} /STYLE meta http-equiv=Content-Type content=text/html; charset=big5 /head body bgcolor=#FF text=#00 link=#00 vlink=#00 alink=#00 font face=Verdana, Arial, Helvetica, sans-serif size=2Equipments' Detail/font:- div align=right font face=Verdana, Arial, Helvetica, sans-serif size=1A = Available H = Hall N = Not in Hall/font ? mysql_connect (localhost, Administrator); mysql_select_db(Hospital); $sql = select * from equipment; $row = mysql_query($sql); ?table width=80% border=1 cellpadding=0 align=center cellspacing=2 bordercolor=#CC /div tr bgcolor=#e5e5e5 ? while ($head = mysql_fetch_field($row)) { echo TDBfont color=#66 size=2 align=center face=Verdana$head-name/font/B/TD; } echo /TR; while ($field = mysql_fetch_row($row)) { echo TR; for ($i = 0; $i = count($field) - 1; $i++) { echo TDfont size=2 face=verdana$field[$i]/font/TD; }echo /TR; } echo /table; if (!$row) echo Failed; else { $num = mysql_num_rows($row); echofont size=1equipment database has got $num data./font; } ? /font form name=form1 method=post action=find_equipment.php font face=Verdana size=1Search individual equipment:/font INPUT onBlur=this.style.backgroundColor='#ff' onFocus=this.style.backgroundColor='#cc' onMouseOver=this.focus() style=font-size:8pt;BACKGROUND-COLOR:#ff; BORDER-BOTTOM: #11 1px dotted; BORDER-COLLAPSE: collapse; BORDER-LEFT: #11 1px dotted; BORDER-RIGHT: #11 1px dotted; BORDER-TOP: #11 1px dotted maxLength=16 name=equipment size=12 type=text input type=submit name=Submit value=Find /form tr bgcolor=#00 p/p font size=1 face=Verdana, Arial, Helvetica, sans-serifa href=menu.htmlMain Menu/a/fontfont size=2 a href=loaned_equipment.phpfont size=1 face=Verdana, Arial, Helvetica, sans-serifLoaned Equipments/font/a/font a href=equipment_add.htmlfont face=Verdana, Arial, Helvetica, sans-serif size=1Add New Equipment /font/a tr bgcolor=#00 /body /html -- END CODE -- HTH, Stuart -Original Message- From: Simonk [mailto:[EMAIL PROTECTED]] Sent: 28 April 2002 20:33 To: [EMAIL PROTECTED] Subject: Re: [PHP] Auto refresh when data changed in Mysql I have added the code, but it turn out : snip The_radix [EMAIL PROTECTED] wrote in message 000501c08528$6d880270$3300a8c0@oracle">news:000501c08528$6d880270$3300a8c0@oracle... You could use Headers to tell the browser to expire the page now.. header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); something like that should do it.. See if it works now.. - Original Message - From: Simonk [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, April 28, 2002 7:50 PM Subject: [PHP] Auto refresh when data changed in Mysql I have made a php + mysql site and hosting in my own IIS server, but in my school network, The page didnt change when i changed the data in mysql server. I think is the cache problem, but i cant fix it even i tick the Update the page everytime when page load in IE. There is no such problem in any home pc. but only in my school's pcs but when i type in www..com/showdata.php then the page can be update. Is there any code or setting can be set to over come this problem? Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Auto refresh when data changed in Mysql
On 28 Apr 2002 at 20:32, Simonk wrote: I have added the code, but it turn out : Warning: Cannot add header information - headers already sent by (output started at C:\Inetpub\php\hospital_equipment.php:5) in C:\Inetpub\php\hospital_equipment.php on line 6 [etc] Here is my full HTML code: html head titleEquipments' Detail/title head [etc] header (Expires: Mon, 1 Jan 1990 05:00:00 GMT);// Date in the past header (Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); // always modified header (Cache-Control: no-cache, must-revalidate); // HTTP/1.1 header (Pragma: no-cache); Put this stuff up above your html and it will most likely work. You must put header stuff before any other output including white space (tabs, spaces, new lines etc). CYA, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php