Hello
Im trying to let the user sort the results after "Pris" and "sted" (Price and place).
I tried following this guide . But i could not get it to work. Nothing happens at my page. Please let me know if you know what I do wrong, and il bold the code I made after the guide. Btw here is a link to the site http://84.212.5.98/1.php I will leave my computer on for a couple of hours.
Code:<form name="myform"> <select name="sort" id="sort" style="float: left;" onChange="javascript:document.myform.submit();"> <option value="Sted">Sted</option> <option value="Pris">Pris</option> </select> </form> <?php $con = mysql_connect("localhost","test","1","lokaler2"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("steder2", $con); $result = mysql_query("SELECT * FROM lokaler2"); $searchResultQuery = " SELECT id, Sted, Pris FROM lokaler2 WHERE MATCH (name) AGAINST ('{$GLOBALS['input']}' IN BOOLEAN MODE) ORDER BY $sort"; echo "<table id='tabbelresultat'> <tr> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr id='tabellresultat'>"; echo "<td id='tabellresultat1'>" . $row['Sted']. '<p/>' .$row['Slag'] . '<p/>' . $row['Pris'] . "</td>"; echo "<td id='tabellresultat'>" . $row['Tekst'] . "</td>"; echo "<td id='tabellresultatbilde'>" . $row['Bilde']."</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?>



Reply With Quote
Bookmarks