another possibly dumb question... I have a database for reviews on items from a webpage. I also have the reviews populating a table on my page based off of the mysql tables data.
What i want to do, and I've searched online but not managed to find a solution, is to reorder the code based upon the selection made on my html dropdown menu.
Any advice?
The code as it stands. If any more is required I can provide it.
<p>Order By: <select>
<option value="newest" id="newest">Newest First</option>
<option value="oldest" id="oldest">Oldest First</option>
<option value="highest" id="highest">Highest Rating</option>
<option value="lowest" id="lowest">Lowest Rating</option>
</select></p>
<?php
include "common.php";
mysql_connect("HOST", "USER", "PASS") or die(mysql_error());
mysql_select_db("DB") or die(mysql_error());
$sql = "SELECT email, review, rating FROM reviews ORDER BY review_id DESC ";
$result = mysql_query($sql)or die(mysql_error());
echo "<table>";
echo "<tr><th>User</th><th>   </th><th>Review</th><th>   </th><th>Rating</th></tr>";
while($row = mysql_fetch_array($result)){
$email = $row['email'];
$review = $row['review'];
$rating = $row['rating'];
echo "<tr>
<td>".$email."</td>
<td></td>
<td>".$review."</td>
<td></td>
<td>".$rating."</td>
</tr>";
}
?>