I want to run a SQL query in a .JS file. I tried to add some PHP codes to it but it didn\'t work of course.
I want to run the SQL query: SELECT price FROM list WH
Execute your query out side the JS and pass the prices in the javascript .
Example :
$res_price = $conn -> query("SELECT price FROM list WHERE q=1");
$row_price = mysqli_fetch_assoc($res_price);
echo $row_price['price'];
Now in Javascript add Like,
If you want add more than one prices then you can manage it through array also make array of price and pass it in the js.