Hi!
I’ve created this page: www.wbplanecompare.com/fighters2.php
I’ve also created a mysql database with all airplanes (+specific id for each plane) and ratings from 1-12 in each category (speed, firepower, turnrate etc etc)
What I want the webpage to do: You choose planes from the drop down lists, press the “send request” button, and the page will then be filled with numbers in the tables below. So in “speed above 20k”, the selected plane’s rating in that area will be displayed. (I later want the numbers be translated to stars, but that is a later problem. I’ve made a visual example at www.wbplanecompare.com/fighters.html)
I have done drop down lists with the following coding:
example 1 in the 2 tables next to submit button:
$planequery=“SELECT * FROM fighters”;
$planeresult=mysql_query($planequery) or die ("Query to get data from firsttable failed: ".mysql_error());
while ($planerow=mysql_fetch_array($planeresult)) {
$plane=$planerow[“plane”];
$id=$planerow[“id”];
echo “<option value=”$id">
$plane ";
}
?>
I am new to coding, but learned fast. However I cannot find a single tutorial on how to show the specific data from the MySQL-db, in the appropriate grey tables below. All 100+ tutorials I’ve found only show how to make the drop-list, which I’ve already done.
P.S. I’ve filled the tables with numbers as a test by using:
<?php $link = mysql_connect('wbplanecomparecom.ipagemysql.com', 'wbplanecompare', 'xxx'); mysql_select_db(wbfighters); $query = mysql_query("SELECT * FROM fighters WHERE id=5"); WHILE($rows = mysql_fetch_array($query)): $firepower = $rows['firepower']; echo "$firepower"; endwhile; ?>however the id= in this case is static, and I want the id to change depending on what plane you select.
Cheers and would be forever greatful if you could help!
/Robert