www.webdeveloper.com
Results 1 to 2 of 2

Thread: Creating a matrix

  1. #1
    Join Date
    Apr 2009
    Location
    Thessaloniki, Greece
    Posts
    24

    Creating a matrix

    Greetings,

    I have a table in a mysql database, structured like that:

    Code:
    ID     maxHi    maxLo    minHi    minLo    value
    1          2         3          4          5         6
    7          8         9         10         11        12 .....
    What it represents, is temperature ranges. For example, for minimum temperature range (4 -5) and maximum temperature range (2 - 3) (the numbers are fictional), I get a value of 6.
    What I want to do, is render a table structured like that:

    Code:
                  (2 - 3)    (4 - 5)    (6 - 7) .....
    (8 - 9)
    (9 - 10)
    (10 - 11)
    And have the cells filled in with the corresponding values for each set of ranges.
    Could anyone help me with this?
    Thanks in advance!
    Last edited by salvi; 05-01-2012 at 01:57 PM.

  2. #2
    Join Date
    Mar 2012
    Posts
    62
    Hi

    $sql="SELECT * FROM table_name";
    $result=mysql_query($sql);
    if(mysql_affected_rows()>0) {

    while($row=mysql_fetch_array($result))
    {
    $cntInOneRow=count($row);
    for($i=1;$i<$cntInOneRow;$i++)
    {
    echo '('.$row[$i].'-'.$row[$i+1].')'.);
    }



    }

    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles