如何中心MySQL表?

时间:2013-07-18 05:00:41

标签: html css

Here is my IMG url:: postimg org/image/dwf13hme9/

<?php
session_start();
if (!isset($_SESSION['username'])) {
header('Location: LoginForm.php');
}
?>


    <html>

    <title>Secured Page</title>

    <head>

    </head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <body>

    <FONT FACE="arial">

    <p align="left" style="margin-left:0px; margin-top: 0px;">

    <table cellspacing="0" cellpadding="5" border="1" width="560">
    <tr style="text-align:center">
    <td style="text-align:left ; width:175px">Record</td>
    <td>Email</td>
    <td>User_Name</td>
    <td>User_Salt</td>
    <td>Pass_Word</td>
    <td>Edit</td>
    </tr>
    </p>

<?php

$db =new mysqli('xxxxxxxxx','xxxxxxxx','xxxxxxxx','xxxxxxxx');

if ($mysqli -> connect_error) {
die('Connect Error: ' . $mysqli -> connect_error);
 }
if ($result = mysqli_query($db, "SELECT * FROM members LIMIT 0,100")) {
while ($row = mysqli_fetch_assoc($result)) {
{
?>

    <tr style="text-align:center">
    <td style="text-align:left">
    <? echo $row['id']; ?></td>
    <td><? echo $row['email']; ?></td>
    <td><? echo $row['usr']; ?></td>
    <td><? echo $row['regIP']; ?></td>
    <td><? echo $row['pass']; ?></td>
    <td><a href="edit.php?id=<? echo $row['id']; ?>">Edit</a></td></tr>    

<?php
}}}
?>

    <form action="Secured_Page_Search.php" method="post">
            Select_Table_To_Display:<br>    <select name="Table">
    <option value="members">Members</option>
    <option value="online">Online</option>
    <input type="submit" name="submit_name" />
    </form> 

    <br><FONT FACE="impact">Logged In @: (<?php echo $_SESSION['username']; ?>)</FONT>


    <style type="text/css">
            body{font-family:Impact;}                                    <--
            #container{width:0px;margin:auto;font-size:15pt;}

            #menu{position:absolute;margin-top:10px;}
            #menu ul .item{display:none;}
            #menu ul:hover tem{display:block;background:#white;padding:1px;margin:1px;}

            #menu ul:hover .item a{color:#abc;text-decoration:none;}
            #menu ul:hover .item a:hover{color:grey;}

#menu ul{width:110px;float:left;margin:0px;padding:2px;background:white;list-   

style:none;}
            .clear{clear:both;height:10px;}
    </style>

    <div id="container">
    <h1></h1>
    <div id="menu">

    <ul id="item1">
    <li class="top">Profile</li>
    <li class="item"><a href="#">Profile User</a></li>
    <li class="item"><a href="#">Profile I.M.</li>
    <li class="item"><a href="#">Profile O.P.</a></li>
    </ul>

    <ul id="item1">
    <li class="top">Edit</li>
    <li class="item"><a href="#">Edit User</a></li>
    <li class="item"><a href="#">Edit I.M.</li>
    <li class="item"><a href="#">Edit O.P.</a></li>
    </ul>
    </div>
    <div class="clear"></div>

    <FONT FACE="impact">

    <p align="left" style="margin-left:0px; margin-top: 110px;">

    <form action="Secured_Page_Search_Email.php" method="post">
            Search, Email:<br>   <input type="text"   name="email"><br>
    <input type="submit" name="submit_name" />
    </form>  

    <form action="Secured_Page_Search_User.php" method="post">
            Search, User:<br>                       <input type="text" name="usr"><br>
    <input type="submit" name="submit_name" />

    </p>

    </form>              
    </body>
    </html>

试图获得一些有用的代码来正确地集中MySQL表。任何帮助将不胜感激!! IMG URL LINK @ TOP

由于

更新代码: 这是我的新IMG网址:: postimg org / image / 5ln0yicmv /

更新代码: 这是我的新IMG网址:: postimg org / image / 5ln0yicmv /

今天早上我更新了代码,这就是结果,新发布的PNG我稍后会回来。谢谢

<?php
session_start();
if (!isset($_SESSION['username'])) {
header('Location: LoginForm.php');
}
?>


    <html>

    <title>Secured Page</title>

    <head>

<style type="text/css">
table.gridtable {
font-family: verdana,arial,sans-serif;
margin: 0 auto;
width: 560px;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}
table.gridtable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
table.gridtable th {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>

    </head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8" />

    <body>

    <FONT FACE="arial">





<?php
$db = new mysqli('xxxx', 'xxxx', 'xxxx', 'xxxxxx');

if ($mysqli -> connect_error) {
die('Connect Error: ' . $mysqli -> connect_error);
}
if ($result = mysqli_query($db, "SELECT * FROM members LIMIT 0,100")) {
while ($row = mysqli_fetch_assoc($result)) {
{
?>

<table class="gridtable">

<tr style="text-align:center">
<td style="text-align:left">
<th>Info</th><th>Info</th><th>Info</th><th>Info</th><th>Info</th><th>Info</th>
</tr>
    <tr style="text-align:center">
    <td style="text-align:left">
    <td><? echo $row['id']; ?></td>
    <td><? echo $row['email']; ?></td>
    <td><? echo $row['usr']; ?></td>
    <td><? echo $row['regIP']; ?></td>
    <td><? echo $row['pass']; ?></td>
    <td><a href="edit.php?id=<? echo $row['id']; ?>">Edit</a></td></tr>   

</table>

<?php
}}}
?>    



    <FONT FACE="impact">
    <form action="Secured_Page_Search.php" method="post">
            Select_Table_To_Display:<br> <select   name="Table">
    <option value="members">Members</option>
    <option value="online">Online</option>
    <input type="submit" name="submit_name" />
    </form> 

    <br><FONT FACE="impact">Logged In @: (<?php echo $_SESSION['username']; ?>)</FONT>


    <style type="text/css">
            body{font-family:Impact;}                                    
            #container{width:0px;margin:auto;font-size:15pt;}

            #menu{position:absolute;margin-top:10px;}
            #menu ul .item{display:none;}
            #menu ul:hover.item{display:block;background:#white;padding:1px;margin:1px;}

            #menu ul:hover .item a{color:#abc;text-decoration:none;}
            #menu ul:hover .item a:hover{color:grey;}

#menu ul{width:110px;float:left;margin:0px;padding:2px;background:white;list-tyle:none;}
            .clear{clear:both;height:10px;}
    </style>

    <div id="container">
    <h1></h1>
    <div id="menu">

    <ul id="item1">
    <li class="top">Profile</li>
    <li class="item"><a href="#">Profile User</a></li>
    <li class="item"><a href="#">Profile I.M.</li>
    <li class="item"><a href="#">Profile O.P.</a></li>
    </ul>

    <ul id="item1">
    <li class="top">Edit</li>
    <li class="item"><a href="#">Edit User</a></li>
    <li class="item"><a href="#">Edit I.M.</li>
    <li class="item"><a href="#">Edit O.P.</a></li>
    </ul>
    </div>
    <div class="clear"></div>

    <FONT FACE="impact">

    <p align="left" style="margin-left:0px; margin-top: 110px;">

    <form action="Secured_Page_Search_Email.php" method="post">
            Search, Email:<br> <input type="text" name="email"><br>
    <input type="submit" name="submit_name" />
    </form>  

    <form action="Secured_Page_Search_User.php" method="post">
            Search, User:<br>                       <input type="text" name="usr"><br>
    <input type="submit" name="submit_name" />

    </p>

    </form>              
    </body>
    </html>

1 个答案:

答案 0 :(得分:2)

这样做:

table
{
   margin: 0 auto;
   width: 560px;
}

<强> FIDDLE