So I selected all bids.
then i have a foreach, where i get stuck.
PHP Code:
foreach($querystrr as $pp2){
$querystr2[] = $database->executeGetOneArray("SELECT * FROM biddings WHERE deviceID = '".$pp2['deviceID']."' ORDER BY bid ASC");
}
I want to print $querystr2's bid value on the screen.
example, to make it more clear:
product id | bid
------------------
1 | 5
2 | 3
1 | 10
2 | 6
So I'll get 10 and 6, and that makes 6 the lowest bid.
06-08-2011, 03:33 AM
Adnarim
Changed $querystr2[] to $querystr2, and changed ASC to DESC to get the highest bid.
Need to print just 1 record per product instead of all multiple times the same record
06-08-2011, 04:55 AM
Adnarim
Having single outputs, but ain't able to select the one with the lowest value...
Anyone a suggestion?
06-08-2011, 05:20 AM
Adnarim
Ok, nevermind, got it..
Just had to set $lowest to 99999999
then used if($bidding['bid'] < $lowest){
$lowest = $bidding['bid'];
}
in the foreach.
06-08-2011, 12:23 PM
Nedals
Why not simply ...
Code:
"SELECT * FROM biddings WHERE deviceID='".$pp2['deviceID']."' ORDER BY bid LIMIT 1"
Will return the lowest value of 'bid' (ORDER BY ... ASC is default)