1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

print values in order

Discussion in 'PHP' started by divinequran, Feb 19, 2009.

  1. divinequran

    divinequran New Member

    Joined:
    Oct 9, 2008
    Messages:
    62
    Likes Received:
    1
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Home Page:
    Hi,

    I have selected mysql database table values as following

    Code:
    client    amount month      year
    
    joe       $50    January    2005
    nick      $52    Feburary   2005
    rubble    $49    march      2005
    nick      $52    January    2005
    nick      $52    March      2005
    rubble    $42    Feburary   2005
    joe       $30    January    2006
    nick      $32    Feburary   2006
    rubble    $39    march      2006
    som       $39    April      2006
    joe       $25    January    2006
    nick      $22    Feburary   2006
    rubble    $19    march      2006
    som       $19    April      2006
    joe       $52    Feburary   2005
    joe       $52    march      2005
    rubble    $40    January    2005
    I want the above values to print as
    Code:
    2005        Joe   Nick  rubble  
    
    January     $50    $52   $49
    Feburary    $52    $52   $40 
    March       $52    $52   $40
    and so on for each year in different table. The year as field type for month and client as field type for amount.
     
  2. Prasanna Gopal

    Prasanna Gopal New Member

    Joined:
    Mar 11, 2009
    Messages:
    3
    Likes Received:
    1
    Trophy Points:
    0
    The best practice in databases is to always have date field in one single field. By separating the month field, you have lost ability to sort or group them by date, and this is what is causing this to be a nightmarish problem.

    Make this change and the problem will become much simpler.
     
  3. pete_bisby

    pete_bisby New Member

    Joined:
    Nov 11, 2007
    Messages:
    48
    Likes Received:
    2
    Trophy Points:
    0
    Occupation:
    Software Developer/Analyst, PB
    Location:
    Manchester, England
    Home Page:

Share This Page