Hello. I am in need of some help. I am trying to display a line of text in a specific location on my page, and them read a new line of text form my database, and replace the old text with the new text.. and on until the end of the table is reached. I am not having a problem getting the data.. but i need to know how, using javascript.. that i can place the text into that one element, without refreshing the web page. There are other things going on in the web page, and i only want that one single element updated with the new text each time the database is read. The scrip i am posting, is included in the page, and is only a portion of what is going on.Here is the code so far..And please remember, this is a include file, not the entire set of code..
$queryname = "SELECT tsid FROM text_save WHERE myprog='$textname'";$resultname = mysql_query($queryname) or exit(mysql_error()); if($rowname = mysql_fetch_array($resultname, MYSQL_ASSOC)) { $_SESSION['textid'] = $rowname['tsid'];} $tsid = $_SESSION['textid']-1;?> <span id="textline"> </span> <?php$query = "SELECT * FROM text_lines WHERE tid='$tsid'";$result = mysql_query($query) or exit(mysql_error());$timepause = 6; while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $textline = $row['text'];?><script>document.getElementById("textline").innerHTML = $textline;</script><?php } } ?>
I still haven't gotten the timer worked out yet, but i need to be able to set a delay time in seconds, and only ready and display that line of text every X number of seconds. I need to display the text in the <span> element. I need ONLY this element to be updated, and the rest of the webpage to not be disturbed, thusly I am looking at javascript to update only that one <span>