I've scoured SOF and google for an answer no joy I am able to connect to a database I presume in JavaScript, I wish to populate the results into a HTML forms option field.
<script type="text/javascript">
function gao(){
var An;
$sql = "SELECT * FROM Anouncements";
// Execute the query
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)){
an=$result[1];
return(an);
}
}
</script>
<head>
<body>
<form action="javascript:gao(s1)"/>
<select name="num" id="s1" required>
<option value="1">gao</option>
</select>
</form>