#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    9
    Rep Power
    0
    Maybe some help as to why this will not work?
    Is it not possible to have a nested while statement?
    The statements DO work when separated.
    Thanks,
    Jim
    Code follows...

    while ($row = mysql_fetch_row($result)){
    echo"<table>";
    $x=0;
    while ($field = mysql_fetch_field($result)){
    echo "<tr><td align = "right">$field->name : </td><td> $row[$x]</td></tr>";
    $x++;
    }
    echo "</table><br><br>n";
    }

    [This message has been edited by JStan (edited July 07, 2000).]
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    45
    Rep Power
    15
    What error do you get when you run it? a little more info might help.......
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    9
    Rep Power
    0
    No error.
    It just will not show the results.
    If I break the code into 2 while statements, the $row statement will write the values and the $field statement will write the fields.

    Put the 2 together and nothing gets written.
    The table is empty.

    thanks,
    jim
  6. #4
  7. 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
    19
    Not sure why that isn't working for you, but I have some alternate code:

    while ($row=mysql_fetch_array($result))
    {
    print "<table>";
    while (list($field,$value)=each($row))
    {
    print "<tr><td align=right>$field: </td><td>$value</td></tr>";
    }
    print "</table><br><br>n";
    }

Similar Threads

  1. Requesting help on READTEXT statement
    By hdokes in forum MS SQL Development
    Replies: 1
    Last Post: March 19th, 2004, 09:53 AM
  2. Question about the WHERE statement
    By layz d in forum MS SQL Development
    Replies: 5
    Last Post: January 28th, 2004, 12:58 PM
  3. nested if-else statement... not working
    By jimmyether in forum PHP Development
    Replies: 3
    Last Post: January 10th, 2004, 10:57 PM
  4. more than 1 nested table
    By tanuja in forum Oracle Development
    Replies: 1
    Last Post: December 30th, 2003, 02:39 AM
  5. Figuring out parts of a mySQL statement
    By ChibiGuy in forum PHP Development
    Replies: 2
    Last Post: August 18th, 2003, 11:38 PM

IMN logo majestic logo threadwatch logo seochat tools logo