Fill tables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • savanm
    New Member
    • Oct 2006
    • 85

    #1

    Fill tables

    Hi all,

    I have a table like this username passworrd
    abcd abcd
    dsadas fdfdsfds

    I want to load the list of the above table in to my html table..
    that is

    in firstrow,firstc olum of the table abcd
    firstrow second column of the table abcd
    secondrow,first column dsadas
    secondrow,secon dcolumn fdfdsfds


    Any one please help me

    Regards..,
    Navas.M
  • savanm
    New Member
    • Oct 2006
    • 85

    #2
    i explain briefly here

    the table in database contains two fields namely username and password

    I want to display this as in my html table

    <tr>
    <td>username</td>
    <td>password</td>
    </tr>

    Regards
    Navas.M

    Comment

    • mainul
      New Member
      • Sep 2006
      • 51

      #3
      Hi try this code:
      [PHP]
      <?
      $sql = mysql_query("se lect * from TABLE_NAME");
      $res = mysql_fetch_ass oc($sql);

      echo "<table width='300' border='0' cellspacing='0' cellpadding='0' >"
      while ($myrow = mysql_fetch_arr ay($result))
      {
      echo"<tr><td>";
      echo "User Name: ";
      echo "</td><td>"
      echo $myrow['username'];
      echo "</td></tr><tr><td>";
      echo "Password</td><td>";
      echo $myrow['password'];
      echo "</td></tr>"
      }
      echo "</table>";
      ?>
      [/PHP]

      Comment

      • savanm
        New Member
        • Oct 2006
        • 85

        #4
        Hi mainul,,

        thanks for ur guidence..

        it helped me 2 achieve my goal

        I use the code like this

        <?php
        $sql = "select * from login";
        $ress = mysql_query($sq l);

        echo ("<table name='data' height='21' width='24' cellpadding='3' cellspacing='3' align='center' bordercolor='bl ack' border='1' bgcolor='#45509 C'>");
        echo "<td>User Name:</td>";

        echo "<td>Passwo rd</td>";
        while($row = mysql_fetch_arr ay($ress))
        {


        echo "<tr>";


        echo ("<td>'$row[user]'</td>");

        // echo "</tr>";



        // echo"<tr>";



        echo ("<td>'$row[password]'</td>");

        echo "</tr>";

        }

        echo "</table>";

        ?>

        Comment

        Working...