通过PHP循环和插入每月计划 [英] Loop and Insert monthly schedule by PHP
本文介绍了通过PHP循环和插入每月计划的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在工作的贷款每月的时间表,我现在遇到了一个问题,生成每月的计划与php和mysql。
我的问题是:
例子:loan date = 2/12/2015,duration = 5 month
我不知道如何插入数据库,像这样:
I'm working on loan monthly schedule right now and I met a problem with generate monthly schedule with php and mysql. My problem is: Example: loan date = 2/12/2015, duration = 5 month I don't know how to insert to database like this:
<table border='1' cellspacing='0' cellpading='0'>
<tr>
<th>Month</th>
<th>Date</th>
</tr>
<tr>
<th>1st month</th>
<th>2/12/2015</th>
</tr>
<tr>
<th>2nd month</th>
<th>3/12/2015</th>
</tr>
<tr>
<th>3rd month</th>
<th>4/12/2015</th>
</tr>
<tr>
<th>4th month</th>
<th>5/12/2015</th>
</tr>
<tr>
<th>5th month</th>
<th>6/12/2015</th>
</tr>
<tr>
<th>6th month</th>
<th>7/12/2015</th>
</tr>
<table>
推荐答案
在此查询中,您可以从时间戳记值中添加下个月,您可以根据您的持续时间进行调整。
In this query add next month from your timestamp value you can adjust this based on your duration try this
INSERT INTO `tbl_book`(`book_date`) VALUES (now( ) + INTERVAL 1 MONTH)
这篇关于通过PHP循环和插入每月计划的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文