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 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Table not outputting

    Hi,
    I am using the code below and the table doesn't seem to be outputting anything such as the remove, just the name, email, gender and ban. Anyone know why it's not working?
    Thanks
    Steven
    PHP Code:
    $result mysql_query($query) or die(mysql_error());
            echo 
    '<table width="1000" border="0.5">
                  <tr>
                    <td width="93">Username:</td>
                    <td>Email:</td>
                    <td>Gender:</td>
                    <td>Banned:</td>
                    <td>Edit:</td>
                    <td>Remove:</td>
                    <td>Ban:</td>
                    <td>Make Admin: </td>
                  </tr>'
    ;
            while(
    $row mysql_fetch_array($result))
            {
            
                echo 
    '
                  <tr>
                    <td width="93">'
    $row['username'].' </td>
                    <td width="93">'
    $row['email'].' </td>
                    <td width="93">'
    $row['gender'].' </td>
                    '
    ; if ($row['ban'] == 1)

                        {
                            echo 
    '<td width="93"><a href="index.php?ACT=03&id='.$row['id'].'">Unban</a></td>';
                        } else 
                        {
                            echo 
    '<td width="93"><a href="index.php?ACT=03&id='.$row['id'].'">Ban</a></td>';
                        } ;
    '
                    <td width="93"></td>
                    <td width="93"><a href="index.php?ACT=04&id='
    .$row['id'].'">Remove</a></td>
                    <td width="93">&nbsp;</td>
                    <td width="137">123</td>
                  </tr>'
    ;
                
            }
            echo 
    '</table>'

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    You ended your first 'echo' statement just before your 'if' statement and you didn't fire up another 'echo' statement for everything below the 'if' statement.

  • #3
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts
    so what would be the code to fix this?

  • #4
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    It should be an easy thing to fix, but...

    PHP Code:
                        {
                            echo 
    '<td width="93"><a href="index.php?ACT=03&id='.$row['id'].'">Ban</a></td>';
                        } ;
    '
                    <td width="93"></td>
                    <td width="93"><a href="index.php?ACT=04&id='
    .$row['id'].">Remove</a></td> 
    to

    PHP Code:
                        {
                            echo 
    '<td width="93"><a href="index.php?ACT=03&id='.$row['id'].'">Ban</a></td>';
                        } ;
                    echo 
    '
                    <td width="93"></td>
                    <td width="93"><a href="index.php?ACT=04&id='
    .$row['id'].">Remove</a></td> 


  •  

    Posting Permissions

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