Help - Search - Members - Calendar
Full Version: arrange rows retrieved from database
HTMLHelp Forums > Programming > Server-side Scripting
rrn
in my website ( php , sql ) . i am retrieving certain rows from database table in the descending order of the date .

for eg : my table will look like this .

title date

aaaa 16/3/2009
bbbb 15/3/2009
cccc 6/2/2009
dddd 2/12/2008
eeee 1/12/2007

what i want to do is

i want to leave a space after each group of years.
ie the table should become as follows

title date

aaaa 16/3/2009
bbbb 15/3/2009
cccc 6/2/2009

dddd 2/12/2008

eeee 1/12/2007

how can i do that? somebody pls give a solution...
Brian Chandler
Where is your existing script for writing them out without special spacing? Just add to it:

On each line: check if year has changed, and if so insert blank line. (Or better just use a different CSS class with more top margin.

Or are you asking someone to do the whole job for you? (That's normally paid work, you know.)
rrn
QUOTE(Brian Chandler @ May 3 2009, 08:21 AM) *

Where is your existing script for writing them out without special spacing? Just add to it:

On each line: check if year has changed, and if so insert blank line. (Or better just use a different CSS class with more top margin.

Or are you asking someone to do the whole job for you? (That's normally paid work, you know.)



i dont need the whole job to be done for me . just need a suggestion or help .

thank you for ur help .

can u suggest how can i check if the year has changed?
Brian Chandler
QUOTE
i dont need the whole job to be done for me . just need a suggestion or help .


Well, the point is that it is *much* easier to help if we can see what we are helping with.


QUOTE
can u suggest how can i check if the year has changed?


In this script that I can't see, there must be some kind of loop. Have a variable with the year from the previous record; compare with the year from the current record; if different, the year has "changed". If you have written the loop to do this, it is beyond me to understand how you can't see how to do this.



This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.