gpt4 book ai didi

php - 如何找到最低唯一出价者并显示该最低唯一出价者的用户名

转载 作者:行者123 更新时间:2023-11-30 00:21:18 25 4
gpt4 key购买 nike

我的数据库是 http://i.imgur.com/p4wUP54.jpg 嘿,我是 php 新手,我不知道如何找到产品拍卖的最低唯一出价者,我还想显示该最低唯一出价者的用户名。请帮助我,我已经尝试过,但遵循一些代码

$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("gunjanbid", $con);
$sql="SELECT * from bid";
$result=mysql_query($sql);
$username=$result['userName'];
$serial=$result['serial'];
$low_sql = "SELECT bidamount,userName, COUNT(bidamount) as bid_count
FROM bid
WHERE bidamount<'{$serial}' AND bid_count=1 AND auction='{$username}'
GROUP BY bidamount";
$low_query = mysql_query($low_sql) ;

$low_bids = array();
if (mysql_num_rows($low_query) > 0)
{
$lower_bid_exist = true;
while ($row = mysql_fetch_assoc($low_query))
{
$low_bids[$row['bidamount']] = $row['bid_count'];
}
} else {
$lower_bid_exist = false;
}

?>
Lowest Unique Bidder :<?php echo $row['userName']; ?>

最佳答案

试试这个:

SELECT bidamount,userName, bidamount as bidamount 
FROM bid WHERE bidamount = (SELECT MIN(bidamount) FROM bid) ORDER BY closing_date LIMIT 1

关于php - 如何找到最低唯一出价者并显示该最低唯一出价者的用户名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23213389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com