Breaking results into week blocks


Posted on 16th Feb 2014 07:03 pm by admin

I have a set of dates (and times), which are returned from a mySQL query.

These usually span from 1-2 months and I need to be able to separate the results (using HTML) every sunday (monday being the start of the week).

Did you know?Explore Trending and Topic pages for more stories like this.
Set of timestamps....
Code: [Select]1255482000
1255483800
1255485600
1255487400
1256086800
1256088600
1256090400
1256092200
1256691600
1256693400
1256695200
1256697000
1257300000
1257301800
1257303600
1257305400
1257904800
1257906600
1257908400
1257910200
1258509600
1258511400
1258513200
1258515000
1259114400
1259116200
1259118000
1259119800

Currently the code looks like this, but having trouble getting round the logic of doing this...

Code: [Select]<?php
while ($sqlresults = mysql_fetch_array($results)) {
$compare = strtotime(date('d F Y',$laststamp)." next Sunday");

echo $sqlresults['timestamp'].'
';
if ($sqlresults['timestamp'] != $laststamp) {
if ($compare > $laststamp) {
#HTML CODE
}
}

$laststamp = $sqlresults['timestamp'];
}
?>

But at the moment it just puts HTML code inbetween every time
No comments posted yet

Your Answer:

Login to answer
101 Like 42 Dislike
Previous forums Next forums
Other forums

Extending Exception to contain method name
I was wondering, if there's a way to extend Exception in such a way, that it would contain name of a

Port scanner problem
Hai
recently i developed one app through which u can check the opened and closed ports under an

Need a Timecode Class...
Not a Time Stamp, Time Code. Format is a bit different. HH:MM:SS:FF where FF is Frames. I dont re

value not going in data base
hello friends....
i am having a working javascript....when i am selecting any

some questions
Hello,

I am looking for the answers for following questions:

1) Does PHP support overl

Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo

How to show next and prev records
Hi all,

Sorry if this is simple, i'm very new to php, well, any programming language actually

RSS feed - FeedList for WordPress
Hi,

I'm trying to alter the FeedList plugin for WordPress so that I can click on the title of

(sub)screen resize modification doesn't work after ECC 6 EhP 4 installation
Hello,

We have previously extended the size of the custom data tab on PO transaction ME23

comparing tables across databases sql refinement ideas required
Hi all

Via pl/sql I need to ensure that data between tables in different databases match

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash