TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Saafia NM
NA
22
8.1k
How cIncrement PHPExcel column dynamically with dynamic name
Dec 28 2017 2:45 AM
Hi,
i am trying to loop columns in a row using another loop result. That is, i have to show date of Sundays/Mondays/Tuesdays... belongs to a month in dynamic columns of an Excel sheet using PHPExcel. My code is:
$lastColumn = $objSheet->getHighestColumn();
$lastColumn++;
for ($column = 'E'; $column != $lastColumn; $column++) {
$date_new='';
$str = $year.'-'.$month.'-';
for($i=1; $i<31; $i++)
{
$ddd = $str.$i;
$date = date('Y-m-D-d', $time = strtotime($ddd) );
if( strpos($date, $day) )
{
$date_new = date('d-m-Y', $time = strtotime($ddd) );
}
}
$objSheet->getCell($column.'3')->setValue($date_new);
}
I am getting the result as :
E
F
G
H
25-12-2017
25-12-2017
25-12-2017
25-12-2017
I have to get like:
E
F
G
H
04-12-2017
11-12-2017
18-12-2017
25-12-2017
Each loop individually giving the result. But nested loop is not working properly. What is the error in my code? Please help me to find out....
Reply
Answers (
0
)
Amalgamating PHP Signup script t HTML web page
how to take print without using print preview in php