Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用查询的MYSQL数据根据用户设置的时间段创建数据点?_Php_Mysql - Fatal编程技术网

Php 如何使用查询的MYSQL数据根据用户设置的时间段创建数据点?

Php 如何使用查询的MYSQL数据根据用户设置的时间段创建数据点?,php,mysql,Php,Mysql,我正在做一个数据库管理系统。用户可以设置从一天到几年的不同时间段。每个条目都有时间戳。如何将时间段划分为图形的数据点(使用GoogleGraphsAPI),而无需对所有时间段进行硬编码?我使用的是MYSQL数据库,主要是php <form name="dateChanger" method="POST" style="padding:10px;" border="1"> Enter the Range of Dates You'd Like. <br> Please No

我正在做一个数据库管理系统。用户可以设置从一天到几年的不同时间段。每个条目都有时间戳。如何将时间段划分为图形的数据点(使用GoogleGraphsAPI),而无需对所有时间段进行硬编码?我使用的是MYSQL数据库,主要是php

<form name="dateChanger" method="POST" style="padding:10px;" border="1">
Enter the Range of Dates You'd Like. <br>
Please Note that if you want 1 day, enter the date you want in the start date in btoh fields<br>
This checks the following Ranges: Day, Week, 2 weeks, 3 weeks, 1-11 months, 1-5 years
Start Date: <input name="startmonth" size=2 type="textbox" maxlength=2>/<input name="startday" size=2 type="textbox" maxlength=2>/<input name="startyear" size=4 type="textbox" maxlength=4><br><br>
End Date:  <input name="endmonth" size=2 type="textbox" maxlength=2>/<input name="endday" size=2 type="textbox" maxlength=2>/<input name="endyear" size=4 type="textbox" maxlength=4><br><br>
<input name="submitbtn2" type="submit">
</form>

输入您想要的日期范围
请注意,如果您想要1天,请在btoh字段的开始日期中输入您想要的日期
检查以下范围:天、周、2周、3周、1-11个月、1-5年 开始日期://

结束日期://


因此,使用此代码可以选择范围。是否有一个框架或其他东西可以让我选择数据点。例如,7月份售出了多少部手机。我可能每天都有一个数据点。但如果他们将日期范围改为6个月,那么我可能每2周就有一个数据点(如售出的手机数量)。如何编写所有这些代码?肯定有什么可以帮助的。

这太宽泛/容易在一个问题中给出自以为是的答案。你需要尝试一下,然后让我们知道什么不适合你。很好的经验法则,如果你能给我们展示代码,那么我们就更有可能提供帮助。好的,我添加了更多,所以更清楚。谢谢你,不过这可能会给你一些想法。以最低公分母(最小日期间隔)将数据保存在数据存储中。然后在图表中汇总。关于谷歌图表中使用的这种格式的数据,这里有一个非常重要的话题:出于上述原因,这个评论只是一个值得思考的问题,并不是一个好的答案。祝你的设计好运,如果遇到问题,请发布新问题