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).

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

101 Like 42 Dislike
Previous php-forum Next php-forum
Other php-forum

Multi-user card game
I'm writing a batch of games and such. Lottery is finished, Poker,blackjack,etc are next. They will

Get dump of MySQL DB from Live Site
I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server.

This is driving me nuts!
This insert query looks to be alright, however I get this error:

QuoteYou have an error in yo

Undefined variable: adHTML
Hello:

While checking my site error logs, I've noticed one repetitive error that fills the lo

Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi

Change Web page language
i doing this thing first time but i dont find any suitable solution for it. On the demand of user. I

Am i doing this wrong?
Im pulling from an Oracle database some info... one of which is a field count_pnums which is a NUMBE

DELETE rows based on content
I have a link in my rows

$bit="http://bit.ly/abcd";
$query = mysql_query("D

GET vs SUBMIT Button to show sections on one index.php page?
Just curious if one of these ways is better (i.e. more efficient) than the other.

I have a

Preg_match with an array
is there an away to use preg_match with an array?

i want to check a string with an array to s

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