Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts

    Putting MySQL Result Data into Array, not printing

    morning all,

    I'm using a pear class to build a chart, the chart gets build by an array of data.. example array :

    PHP Code:
    $DS[0][0] =& Image_Graph::factory('dataset', array(array('A' => 1'B' => -2'C' => 1'D' => 3'E' => -1))); 
    That works great no problem, I'm not trying to populate that array from a mysql result ..

    I have some mysql stuff, query etc and then ..
    PHP Code:
        while ($row mysql_fetch_array($result)) {

        } 
    Now im stuggilin to populate the array with each row, obviously it goes in the middle of that while loop ..

    The best way to do it ... ?

    any pointers would be apperciated
    cheers all
    p

  • #2
    Senior Coder
    Join Date
    Aug 2003
    Location
    One step ahead of you.
    Posts
    2,815
    Thanks
    0
    Thanked 3 Times in 3 Posts
    PHP Code:
    <?php
    $result 
    mysql_query($sql);
    for(
    $rowset = array(); $row mysql_fetch_array($result); $rowset[] = $row);
    ?>
    I'm not sure if this was any help, but I hope it didn't make you stupider.

    Experience is something you get just after you really need it.
    PHP Installation Guide Feedback welcome.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    905
    Thanks
    23
    Thanked 5 Times in 5 Posts
    Thanks for your help ..sorted.. much apperciated. *bookmarked*


  •  

    Posting Permissions

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