God i'm having a terrible time trying to do this. Does anyone know how to set a javascript variable as a query result from a MySQL database.
As an example, like this:
Set this query:
$query4=mysql_query("select price from pricelist where item='$result3[item]'");
$result4=mysql_query($query4);
into a variable:
var price
i just can't do it. I've tried doing it like this:
function updateTotalPrice(){ //show the price of the sub category
var amount = document.getElementById('amount');
var total = document.getElementById('totalPrice');
<?
$query4=mysql_query("select price from pricelist where item='$result3[item]'");
$result4=mysql_query($query4);
//echo ="total.value == $result4[price];";
?>
total.value = <?$result4['price'];?>;
}
But the thing stops my <body onLoad=""> function from working. I'm no expert in Javascript.
Cheers guys.