Is there a way to insert the information i get from the API to MYSQL? i been looking everywhere and can't find nothing about it, google,youtube.... i'm going crazy. This is my code to fetch the data from the api.
from this code i get a ranking with Position, Name, Highscore.
NOTE: I'm not asking for someone to take time out of his day and make me the code, i'm simply asking for directions or a website that teaches you how to do it. THANK YOU IN ADVANCE.
getData();
async function getData() {
const response = await fetch('http://localhost:3008/api/highscore/players')
console.log(response);
const data = await response.json();
const req = await fetch('http://localhost:3008/api/players')
console.log(req);
const info = await req.json();
length = data.players.length;
console.log(data);
var temp = "";
for (i = 0; i < length; i++)
for (j = 0; j < length; j++) {
{
if (info.players[i].id == data.players[j].id) {
temp += "<tr>";
temp += "<td>" + data.players[j].position + "</td>";
temp += '<td><a href="#">' + info.players[i].name + '</a></td>'
temp += "<td>" + data.players[j].score + "</td>";
temp += "</tr>";
}
}
}
document.getElementById("data").innerHTML = temp;
}
function myFunction() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("data");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}```