Jump to content



  • Please log in to reply
No replies to this topic

#1 ober

  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 01 May 2006 - 01:11 PM

So I have a project where I'm graphing 2 recordsets against each other, and each recordset contains 12000 records. I first pull the data out of a database and dump it into arrays, then I feed those arrays to the graphing function. The users have the option to graph up to 5 channels (columns of data) at a time, so before I was checking to see if the channel was selected and then adding a value to that specific array.

What I've done (and I've run the timing numbers and it is faster) is to calculate the total number of channels that have been selected and us a switch without breaks to figure out how many I have to fill:
    if($result && mssql_num_rows($result) > 0)
        $d0 = array();
        $d1 = array();
        $d2 = array();
        $d3 = array();
        $d4 = array();
        while($row = mssql_fetch_array($result))
                case 5:
                    $d4[] = $row[5];
                case 4:
                    $d3[] = $row[4];
                case 3:
                    $d2[] = $row[3];
                case 2:
                    $d1[] = $row[2];
                case 1:
                    $d0[] = $row[1];
        $t1ok = false;
        echo '<br/><br/><p class="warn">There is no 10Hz data for test 1.</p>';

I guess I'm just curious if someone would have a better way to do this, as I think I've come up with the best solution.

Info: PHP Manual

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users