I want to make a list, where I have to fetch more than one object from a database.
So with the query and the "fetch_object"-function I need to sort get the "Omschrijving" and "Verkoopprijs" from a database.
They have to be sorted according to the value (selected with a dropdown menu in the html code).
What I'm getting now as a result is only the last item from the database, so nothing cheaper.
If there are any questions, please ask them.
Highlighted in bold you can find the important items in the code.
thanks in advance
Expand|Select|Wrap|Line Numbers
- <?
- if(isset($_POST['submit'])){
- $infomin = $_POST['minimumprijs'];
- $infomax = $_POST['maximumprijs'];
- $keuze = mysql_query("SELECT omschrijving, verkoopprijs FROM artikel WHERE verkoopprijs BETWEEN '$infomin' AND '$infomax'");
- $obj = mysql_fetch_object($keuze);
- $minprijs = $_POST['minimumprijs'];
- $maxprijs = $_POST['maximumprijs'];
- if($minprijs>$maxprijs){
- print "Foutmelding: De minimumprijs mag niet hoger zijn dan de maximumprijs!";
- }
- else{
- print "<tr> <td> Artikelnaam: </td> <td> Prijs: </td> </tr> <br/> ";
- print "<tr> <td> $obj->omschrijving </td> <td>$obj->verkoopprijs</td> </tr>";
- }
- }
- ?>