alert displays only numeric values. If I “mix” the letters, an Uncaught ReferenceError error occurs: yyyyyyyy is not defined

<?php $con = mysqli_connect('localhost','bla','bla','bla'); $sql = mysqli_query($con,"SELECT data, content FROM sinc"); while ($result = mysqli_fetch_assoc($sql)) { echo "<script>alert (".$result['data'].")</script>"; } 

?>

  • 2
    Do you see the script running in the browser? And how should the lines in js look like? - vp_arth
  • 2
    I will write a more obvious comment: perhaps there are not enough quotes? oO - teran

1 answer 1

 echo "<script>alert('".$result['data']."')</script>"; 

East:

  1. Comment: №1, author: vp_arth ;
  2. Comment: №2, author: teran, ed .: StackOverflow, 2017.