gpt4 book ai didi

php - 仅具有一个标题的按月输出

转载 作者:行者123 更新时间:2023-11-29 13:21:31 25 4
gpt4 key购买 nike

我一直在尝试将其从当前输出转换为“按月”输出。我要把我所有的头发都拔出来。我想做的是以月为单位对游戏进行分组。因此,一月、二月、三月等都会在其下方包含每个游戏。现在,我必须为每个团队执行此操作,并为每个团队创建一个静态占位符和新变量。

数据库结构

[id]   [opponent]   [month]   [team]   [notes]   [date_added]   [buyLink]
[time] [date]

<?php
// Check to see the URL variable is set and that it exists in the database
// Connect to the `MySQL` database
include "../../includes/db_conx.php";
//--------------------------------------------------------------------------------------
$sqlcountRam = "SELECT * FROM discounts WHERE team='cyoram' ORDER BY date ASC";
$sql_countRam = mysqli_query($db_conx,$sqlcountRam);
$calCountRam = mysqli_num_rows($sql_countRam);
//--------------------------------------------------------------------------------------
if ($calCountRam > 0) {
// get all the product details

$x=0;
while($row = mysqli_fetch_assoc($sql_countRam)){


$id = $row["id"];
$opponent = $row["opponent"];
$team = $row["team"];
$notes = $row["notes"];
$month = $row["month"];

$buyLink = $row["buyLink"];

$time = $row["time"];
$date = $row["date"];
$formatted_date = date("l d F Y H:i A", strtotime($date));
$raw = "$formatted_date";
$xplod = explode(' ',$raw);
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
include "includes/logos.php";


/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
$classCssRam = "inline-block";
$x++;
$classChangeRam = ($x%2 == 0)? 'whiteBackground': 'grayBackground';

$product_listRam .= "
<div class='aNew' style='clear:both;display:<?php echo $classCssRam; ?>'>

<div class='monthSalute'>$month</div>

<table width='400px' border='0'>
<tr class='$classChange'>
<td rowspan='2' class='date' >$xplod[1]</td>
<td class='day'>$xplod[0]</td>
<td rowspan='2' class='centerLogo'><div class='containImgPos'><img src='$imgLogo' height='32px' style='position:relative;left:$posImgR;' /></div></td>
<td class='city'>$city</td>
<td rowspan='2' class='butt_pad'><a href='calendar_edit.php?pid=$id'>edit</a> &bull; <a href='calendar_list.php?deleteid=$id'>delete</a></td>
</tr>
<tr class='$classChangeRam'>
<td class='time $classChangeRam'>$time</td>
<td class='opponent $classChangeRam'>$opponent</td>
</tr>
</table>
</div>



";
}
}
else {
$product_listRam = "";
$classCssRam = "none";
}

?>

最佳答案

更改数据库结构中的日期格式,并包括开始日期和结束日期以根据这样的月份获取数据:这将为您提供月份数据,希望它有用

 $mon = 1;
$i=1;
$specify = array();
while($mon <=12)
{
$startdate = '2012-'.$mon.'-01';
$enddate = '2012-'.$mon.'-31';`
$result = mysql_query("SELECT * FROM discounts WHERE `date` BETWEEN '".$startdate."' AND '".$enddate ."'");
$row[i] = mysql_fetch_assoc($result);
$i++;
}

关于php - 仅具有一个标题的按月输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20779301/

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