#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Norcross, GA
    Posts
    458
    Rep Power
    14
    See sample code below, or click here for a text version: http://www.georgiaoffroad.com/sample.txt

    As it stands, the fist row (Version) prints to the screen (data from the 'techman' database, that is); every row thereafter is blank.

    Do I need to make a seperate query for each row of data? It seems like php is releassing the data from the buffer after printing the first row. There are no script errors.

    I appreciate your help.

    ## Sample code ##

    <html> html code blablah

    <?php

    $db = mysql_connect("localhost","office","website");

    mysql_select_db("techman",$db);

    $result = mysql_query("SELECT * FROM ver WHERE pmsid='EAGLE'",$db);

    ?>

    <table width="700" border="0" cellpadding="5" cellspacing="0">


    <tr>
    <td bgcolor=325f61><p class="bold2">Version</p></td>

    <?php

    do {
    echo "<td bgcolor=325f61><p class="bold2">";
    printf("%s", $myrow["ver"]);
    echo "</p></td>n";
    } while ($myrow = mysql_fetch_array($result));

    ?> </tr>


    <tr>
    <td bgcolor=325f61><p class="bold2">Interface:</p></td>
    <?php

    do {
    echo "<td bgcolor=325f61><p>";
    printf("%s", $myrow["interface"]);
    echo "</p></td>n";

    } while ($myrow = mysql_fetch_array($result));

    ?> </tr>

    <tr>
    <td bgcolor=325f61><p class="bold2">Acme path:</p></td>
    <?php

    do {
    echo "<td bgcolor=325f61><p>";
    printf("%s", $myrow["installdir"]);
    echo "</p></td>n";
    } while ($myrow = mysql_fetch_array($result));

    ?> </tr>


    </td></tr></table>
    html code blablah
    </html>
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    No, but you do need to refresh your result set to the beginning. Once you've broken out of your do...while because $myrow=mysql_fetch_array(... has evaluated to false, what makes you think it'll evaluate to true the next time?? ;-)

    You'll need to use mysql_data_seek($result,0) to reset the result index to the 0th record after each loop.

Similar Threads

  1. learning and stumped - tables and form problem
    By CoderAgain in forum HTML Programming
    Replies: 3
    Last Post: November 5th, 2003, 04:29 PM
  2. Query string error has me stumped
    By lull45209 in forum MySQL Help
    Replies: 1
    Last Post: July 10th, 2003, 03:35 PM
  3. Real Queued animations? How? I'm stumped
    By wiredloose in forum HTML Programming
    Replies: 0
    Last Post: July 8th, 2003, 04:12 PM
  4. A bit stumped (PHP + MySQL
    By PHP-Freak in forum PHP Development
    Replies: 5
    Last Post: July 17th, 2002, 02:45 PM
  5. Stumped, trying to pass PHP to Javascript.
    By zewt in forum JavaScript Development
    Replies: 0
    Last Post: November 16th, 2001, 08:06 PM

IMN logo majestic logo threadwatch logo seochat tools logo