jfs0479 Posted February 14, 2007 Share Posted February 14, 2007 Hi, At the moment i am still learning PHP so bear with me. Currently i have a routes system that all have ID like HS001...HS023...etc. I am currently using the code below for the routes system so that when i type in routes.php?RID=001 this will show the route with the number HS001 assigned to it. The problem is that for some of them they have been assigned two route numbers like HS001 has two departures and i was wondering as i have seen on websites wheter you could sort it so i could have routes.php?RID=HS001&DepartingAirport=Gatwick ? If you could you would be a saviour! James The Code <?php $link = mysql_connect("server_address", "username", "password"); mysql_select_db("database_name", $link); $routeid = $_GET['RID']; $result = mysql_query("SELECT * FROM routes WHERE RID = '$routeid'"); ?><html><title>Our Routes</title> <style type="text/css"> <!-- .style6 {font-family: "century Gothic"; font-size: 12px; } .style8 {color: #C70391} --> </style> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="style6"> <tr> <td width="10%" bgcolor="#F3F3F3"><u>Route ID </u></td> <td width="20%" bgcolor="#F3F3F3"><u>Departing Airport </u></td> <td width="23%" bgcolor="#F3F3F3"><u>Arriving Airport </u></td> <td width="16%" bgcolor="#F3F3F3"><u>Departing Time </u></td> <td width="13%" bgcolor="#F3F3F3"><u>Distance (km) </u></td> <td width="8%" bgcolor="#F3F3F3"><u>Altitude</u></td> <td width="10%" bgcolor="#F3F3F3"><u>Aircraft</u></td> </tr> <?php while ($row = mysql_fetch_assoc($result)) {?><tr> <td><span class="style8"><?php echo $row['RID'];?> </span></td> <td><?php echo $row['Departingairport'];?> (<?php echo $row['DepartingICAO'];?>)</td> <td><?php echo $row['Arrivingairport'];?> (<?php echo $row['ArrivingICAO'];?>)</td> <td><?php echo $row['DepartingTime'];?> </td> <td><?php echo $row['Distance'];?> </td> <td><?php echo $row['Alt'];?> </td> <td><?php echo $row['Aircraft'];?> </td> </tr><?php } ?> </table> <p class="style6">We have a total of <? include 'db.php'; $query_count = "SELECT * FROM routes"; $result_count = mysql_query($query_count); $totalrows = mysql_num_rows($result_count); echo $totalrows ?> routes in our database </p> </body></html> Link to comment https://forums.phpfreaks.com/topic/38497-narrowing-results-down/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.