fekaduw Posted June 20, 2007 Share Posted June 20, 2007 hello there, i was trying to display a text (read from a mysql db) on a frame (iframe). But it only displays an old data evenif i update the db. How can i modify it so that i can display the new updated text read from the database. here is the code that fetchs the data from the database..........it is saved by the name message.php <?php require("../includes/dbconnection.php"); $SQL="SELECT * FROM tblaboutethiopia"; $result=mysql_query($SQL); if($row=mysql_fetch_array($result)) $vdesc=stripslashes($row["description"]); else $vdesc=""; ?> <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <?php echo $vdesc; ?> </body> The other page that displays the iframe contains the following code: <script language="javascript"> document.write ('<iframe src="aboutethiopia_message.php" id="message" width="440" height="220" name="mess1"></iframe>') frames.message.document.designMode = "On"; </script> Everything works perfectly except displaying an old data... i appreciate any help thanks Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/ Share on other sites More sharing options...
Dragen Posted June 20, 2007 Share Posted June 20, 2007 if the file is saved as message.php should the iframe src be message.php? <script language="javascript"> document.write ('<iframe src="message.php" id="message" width="440" height="220" name="mess1"></iframe>') frames.message.document.designMode = "On"; </script> Also have you tried clearing your cache? Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278410 Share on other sites More sharing options...
fekaduw Posted June 20, 2007 Author Share Posted June 20, 2007 sorry, the iframe's src is message.php. sorry i posted the wrong code. Having the iframe's src="message" still the problem exists Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278412 Share on other sites More sharing options...
Dragen Posted June 20, 2007 Share Posted June 20, 2007 I can't see how it would display old data as everytime the frame is loaded it's collecting the data, so it's not like it's getting it from the cache. Are you sure you're editing the right database table? or getting the data from the orrect table/column? Sounds silly, but it could be that you've got an older version of the txt saved in the same table and it's finding that one first.. If that's so you should have a WHERE setting in your mysql statement to verify which one to look for. Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278418 Share on other sites More sharing options...
fekaduw Posted June 20, 2007 Author Share Posted June 20, 2007 well, i checked the db. it contains the new data. to ur surprise whenever i try to update the text from the iframe, it updates the database but it will display the old text that has been in the db. When i look into the db, it contains the new text... what could be the problem then? Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278790 Share on other sites More sharing options...
Dragen Posted June 20, 2007 Share Posted June 20, 2007 To be honest I'm not sure. I can't see a reason that would happen... What does this javascript part do? frames.message.document.designMode = "On" Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278795 Share on other sites More sharing options...
fekaduw Posted June 20, 2007 Author Share Posted June 20, 2007 i included the frames.message.document.designMode = "On"; code so as to make the iframe editable. But when i comment it, it displays the correct data. Very unfortunately the iframe becomes not editable. I mean i couldn't type in data... is there any solution for that? Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278805 Share on other sites More sharing options...
Dragen Posted June 20, 2007 Share Posted June 20, 2007 how about using a textara instead. <textarea><?php require('message.php'); ?></textarea> and have it as a form to submit. Then in message.php change the code to: <?php require("../includes/dbconnection.php"); $SQL="SELECT * FROM tblaboutethiopia"; $result=mysql_query($SQL); if($row=mysql_fetch_array($result)) $vdesc=stripslashes($row["description"]); else $vdesc=""; echo $vdesc; ?> Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278815 Share on other sites More sharing options...
fekaduw Posted June 20, 2007 Author Share Posted June 20, 2007 A good idea.. thanks a lot Link to comment https://forums.phpfreaks.com/topic/56355-how-can-i-refresh-the-contents-of-the-iframe/#findComment-278823 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.