<?php
$query3 = "SELECT message FROM messageslive LIMIT 1";
$result3 = mysql_query($query3,$connection) or die (mysql_error());
confirm_query($result3);
while($userinfo3 = mysql_fetch_array($result3)){
$msgLive = $userinfo3['message'];
}
?>
<script type="text/javascript">
var msg = "<?php echo $msgLive ; ?>";
</script>
I am worried when the database table contains too much data to search and retrieve, so the PHP variable $msgLivedoesn't matter yet, so the Javascript variable var msggets an empty value. How to set javascript until the PHP variable $msgLivegets the value and then passes the value from the php variable to Javascript?
source
share