Jump to content

How can i refresh the contents of the iframe


fekaduw

Recommended Posts

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

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?

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.

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?

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?

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; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.