PDA

View Full Version : Updating Text From A MySQL DataBase ?



Jamie452
12-24-2007, 10:35 PM
Hey,

I want to every second change the text that is displaid to what I have in my MySQL database using PHP. How on earth do I do this?

So far I have got..


<script type="text/javascript">
<!--

function updateMessage ( )
{
<?php
//This will load something like the time, mot saying I will use that query
$message = mysql_query("SELECT * FROM message WHERE username='admin'");
?>
document.getElementById("message").firstChild.nodeValue = "<?php echo "$message"; ?>";
}

// -->
</script>
<body onload="updateMessage(); setInterval('updateMessage()', 1000 )">
<span id="message"><?php echo "$message"; ?></span>
</body>


I am very greatful for any help you can give me, please note I MUST use PHP and MySQL.