I have a table on my web page that is currently updating with random Data, see below:
function changeContent(){
var i = 1;
var len = numberRows;
var random1 = Math.floor( Math.random() * 90 ) + 10;
var random2 = Math.floor( Math.random() * 90 ) + 10;
var x=document.getElementById('myTable').rows;
var y=x[0].cells;
for (; i < len; i++) {
var d = new Date(); // for now
y=x[i].cells;
y[0].innerHTML=eventNumber++;
y[1].innerHTML=Math.floor( Math.random() * 90 ) + 10000
y[2].innerHTML= (d.getHours()<10?'0':'') + d.getHours() +
":" + (d.getMinutes()<10?'0':'') + d.getMinutes() +
":" + (d.getSeconds()<10?'0':'') + d.getSeconds();
y[3].innerHTML=Math.floor( Math.random() * 90 ) + 10;
y[4].innerHTML=Math.floor( Math.random() * 20 ) + 5;
y[5].innerHTML=Math.floor( Math.random() * 20 ) + 5;
y[6].innerHTML=Math.floor( Math.random() * 20 ) + 5;
y[7].innerHTML=Math.floor( Math.random() * 20 ) + 5;
y[8].innerHTML=Math.floor( Math.random() * 20 ) + 5;
}
}
I would like replace the (Math.random() * 20) + 5 , with a query that is going to pull data from a MySQL database that I have created.
Any help would be greatly appreciated.
Best Regards.
Andy