gpt4 book ai didi

php - 我如何获得特定用户的最后 7 个投注单 (BetSlipID)

转载 作者:行者123 更新时间:2023-11-29 06:54:23 25 4
gpt4 key购买 nike

我当前的代码显示最近 7 天的投注单,但我需要显示最近 7 天的投注单,无论日期如何。

select 
betsliphistory.MatchID,Team1.Name as HomeTeam ,
Team2.Name as AwayTeam, BetSlipID , userid , TipID ,
matches.ResultTipID ,betsliphistory.`Date`
from betsliphistory
inner join matches on betsliphistory.MatchID = matches.MatchID
inner join teams as Team1 on matches.HomeTeamID = Team1.TeamID
inner join teams as Team2 on matches.AwayTeamID = Team2.TeamID
where userid =".$user."
and betsliphistory.`Date` between CURDATE()-7 and CURDATE()
order by BetSlipID , MatchID;

最佳答案

but I need to show last 7 bet slips regardless of the date.

  • WHERE 子句中删除日期条件。
  • ORDER By BetSlipID DESCLIMIT 7 用于前 7 个 BetSlipID,如下所示:

     ... -- Your current query
    WHERE userid = ".$user."
    ORDER BetSlipID DESC
    LIMIT 7;

请注意:您以这种方式编写的代码容易受到 SQL Injection 的攻击.请改用 PDO 或准备好的语句。有关更多详细信息,请参见:

关于php - 我如何获得特定用户的最后 7 个投注单 (BetSlipID),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13622603/

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