Results 1 to 2 of 2

Thread: calling info from database

  1. #1
    Join Date
    Mar 2003
    Location
    ireland
    Posts
    7

    calling info from database

    Hi..

    i am trying to call ALL da usernames and teamname in my members table! it is only dispaying one username/teamname.

    this is my code..

    <?
    include("connect2db.php");

    $result = mysql_query("select teamname, username from members");
    ## Query detail specification ##
    $row = mysql_fetch_array($result);

    while ($row = mysql_fetch_array($result)){
    // output teamname and a line break
    echo $row['teamname'];
    echo $row['username'];
    echo $row[2]."<br>";
    }
    ?>

    any ideas how to display all information on username/teamname in table instead of just one row????

  2. #2
    Join Date
    Feb 2003
    Location
    Johannesburg, South Africa
    Posts
    145
    I am no PHP expert, hell - not even a beginner BUT I would say it looks like you can delete the row:

    $row = mysql_fetch_array($result);
    as you have it twice ( again in the loop ).

    Hope that helped. Cheers.

Posting Permissions

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