Nothing is returned into the text area when I click on the "query" button at the bottom. The data is fetched from Mysql properly but I cannot get the results into a textarea (textContent). Also I cannot find in PHP a definition for creating an array i.e. x = []; as in Javascript. basically I am trying to return query reqults from MYSQL into Javascript/HTML. THANKS for the help. Yes I have researched this and trial and errored it with no good results.
<!DOCTYPE html>
<html>
<head>
<textarea rows="10" cols="50" maxlength = "20000" id = "textContent">Content</textarea> 
<style>
table {
    width: 100%;
    border-collapse: collapse;
}
table, td, th {
    border: 1px solid black;
    padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = intval($_GET['q']);
$con = mysqli_connect('localhost','root','gwatchgwatch63','mdmmp');
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"jvrs");
$sql="select objectID,objectTextLine from objecttextline where objectID = '".$q."' order by objectTextLineOrder";
echo "SQL::".$sql;
$result = mysqli_query($con,$sql);
$textContent[0] = " "; 
$textContent[1] = " "; 
$textContent[2] = " "; 
$textContent[3] = " "; 
$textContent[4] = " "; 
$textContent[5] = " "; 
$i=0;
while($i < 6 and $row = mysqli_fetch_array($result)) {  
$textContent[$i] = $row['objectTextLine'] ;
    echo $textContent[$i];
           }
mysqli_close($con);
?>
<button onclick={document.getElementById("textContent").value="<?php echo $textContent[0]; ?>";}>query</button>
<button 
onclick={x=document.getElementById("textContent").value;alert(x);}>query1</button>
</body>
</html>
