SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Oct 2001
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Displaying Tables in mySQL w/PHP

    I am a newbie at this and I want to display all the data in a table with no sorting, but want it in a html table format.

    I know this is possible..

    I came up with this... but this doesn't do it...

    you can view the output here:

    http://63.216.178.246/members.php

    The code:

    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
    <TITLE>Members</TITLE>
    </HEAD>
    <BODY>

    <?php
    $conn=mysql_connect("localhost","username","password");
    mysql_select_db("",$conn);




    $sql="SELECT * FROM [tblMembers]";


    ?>
    <TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial"

    COLOR=#000000><CAPTION><B>Members</B></CAPTION></FONT>

    <THEAD>
    <TR>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>ID</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>FirstName</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Initial</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>LastName</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Address1</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Address2</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>City</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>State</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Zip</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>HomePhone</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>WorkPhone</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Fax</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Email</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Userid</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Password</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Registered</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Modified</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:10pt FACE="Arial"

    COLOR=#000000>Modified By</FONT></TH>

    </TR>
    </THEAD>
    <TBODY>

    <TR VALIGN=TOP>
    <TD BORDERCOLOR=#000000 ALIGN=RIGHT><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif"

    COLOR=#000000><? echo htmlspecialchars(("ID").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("FirstName").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Initial").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("LastName").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Address1").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Address2").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("City").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("State").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Zip").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("HomePhone").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("WorkPhone").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Fax").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Email").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Userid").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Password").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ALIGN=RIGHT><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif"

    COLOR=#000000><? echo htmlspecialchars(("Registered").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ALIGN=RIGHT><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif"

    COLOR=#000000><? echo htmlspecialchars(("Modified").$Value); ?><BR></FONT></TD>
    <TD BORDERCOLOR=#000000 ><FONT style=FONT-SIZE:8pt FACE="MS Sans Serif" COLOR=#000000><?

    echo htmlspecialchars(("Modified By").$Value); ?><BR></FONT></TD>

    </TR>

    </TBODY>
    <TFOOT></TFOOT>
    </TABLE>
    </BODY>
    </HTML>

    ADVISOR EDIT: I removed your username and password from the code for you. Posting that information publically is usually a bad idea. You might also want to change it now since some people did see it.
    Last edited by aspen; Oct 26, 2001 at 18:35.


Bookmarks

Posting Permissions

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