php 表不完整

标签 php css

report table

我在 php 中使用 css 创建了表格,但表格并不完整,正如您在下载部分的照片中看到的那样。它的一半在下载部分。 请有人查看我的代码,让我知道我哪里出错了。 谢谢。

我的CSS代码

<style type='text/css'>



.container3 {
float:left;
width:100%;
/*background:green;*/
overflow:hidden;
position:relative;
}

.container2 {
float:left;
width:100%;
background:#FFA500;
position:relative;
right:45%;
}


.container1 {
float:left;
width:100%;
/*background:red;*/
position:relative;
right:40%;
}

.col1 {
float:left;
width:26%;
position:relative;
left:87%;
bottom:-200px;
font-size:20px;
text-align:left;
overflow:hidden;
height:570px;
}


.col2 {
float:left;
width:50%;
position:relative;
left:90%;
overflow:hidden;
}

.col3 {
float:left;
width:26%;
position:relative;
left:80%;
overflow:hidden;
}

.footer {
        border:1px solid orange;
        position: relative;
        padding:0px;
        margin-top:-5px;
    font-size:15px;


    }


.signout {
position:       absolute;
left:           5px;
bottom:         150px;
width:          130px;
clear: both;
font-size:20px;
text-align:center;
}

.tableClass{
 margin-bottom:60px;
}

</style>


<style>
table
{
border-collapse:collapse;
}
table, td, th
{
border:1px solid black;
}
</style>


 <style>
 table,td,th
 {
 border:1px solid black;
 }
 td
 {
  text-align:center;
  }
  </style>


<style>
table,td,th
{
 border:1px solid black;
}
table
{
width:100%;
}
th
{
height:50px%;
}
</style>

我的 php 代码

<div id="header" style="background-color:#FFA500;">

<h1 style="margin-bottom:0;">Wellcome To Balhaf Services Customer Reports</h1>

<div class="container3 ">
<div class="container1 ">
<div class="container2 ">


<div class="col1">

View Report <br />
View Chart <br />

</div>


<?php


$username = $_POST["username"];
$password = $_POST["password"];




// Connect to the database
$dbLink = new mysqli('localhost', 'sqldata', 'sqldata', 'balhaf');
if(mysqli_connect_errno()) {
die("MySQL connection failed: ". mysqli_connect_error());
}


//for mysql injection (security reasons)

$username = mysqli_real_escape_string($dbLink, $username);

$password = mysqli_real_escape_string($dbLink, $password);




mysqli_select_db($dbLink,"balhaf2");


//checking if such data exist in our database and display result

$login = mysqli_query ($dbLink,"select * from users where USERNAME = '$username' and

PASSWORD = '$password'");

if(mysqli_num_rows($login) == 1) {


// Fetch the file information
$query = "select *  from users WHERE username = '".$dbLink->escape_string($username)."'";



 $result = $dbLink->query($query);
 $company = false;
 //Now get the result information
$row = $result->fetch_object();  //will store the record in $row

//Access what you need
if($row) {
    $company = $row->company;  //variable name should match the field name in your database
    echo $company; //See if you get the value stored in the database
}


mysqli_select_db($dbLink,"balhaf");


// Query for a list of all existing files
$sql = "SELECT id, name, mime, size, created FROM $company";
$result = $dbLink->query($sql);

// Check if it was successfull
if($result) {
// Make sure there are some files in there
if($result->num_rows == 0) {
    echo '<p>There are no files in the database</p>';
}
else {
    // Print the top of a table

echo    '<div class="col2">';
echo    '<div align="center">';
    echo    '<H2 align="center"> Report Table</H></div>'; 

echo '<table border="1" align="center"class="tableClass"> 


            <tr>
            <td><b>Name</b></td>
           <td><b>Mime</b></td> 
            <td><b>Size (bytes)</b></td>
            <td><b>Created</b></td>
           <td><b>Download</b></td>
            </tr>';


    // Print each file
    while($row = $result->fetch_assoc()) {
        echo "
            <tr>
                <td>{$row['name']}</td>
                <td>{$row['mime']}</td>
                <td>{$row['size']}</td>
                <td>{$row['created']}</td>
                <td><a style='text-decoration:none;'href=' get_file_work.php?id={$row['id']}&company=$company'>Download</a></td>
            </tr>";
    }

    // Close table
    echo  '</table>';
echo '</div>';
  }



// Free the result
$result->free();
}
else
{
echo 'Error! SQL query failed:';
echo "<pre>{$dbLink->error}</pre>";
}

// Close the mysql connection
$dbLink->close();


}

  else {

  echo "worng user"."</br>";
  }


  ?>


 <div class="col3">

 </div>

 </div>


   </div>

    <div class="signout">

   <a  style='text-decoration:none;' href= "index.html">Sign Out </br></a>

   </div>
  <div class="footer" style="background-color:#FFA500;clear:both;text-align:center;">
  Copyright balhaf services 20103-2014</div>

   </div>

最佳答案

您的 container3 正在使用 "overflow:hidden;"

切断其内容的显示

您可以将其切换为:

.container3 {
float:left;
width:100%;
/*background:green;*/
overflow:auto;
position:relative;
}

或者,如果您不想流血,您可以将文件名替换为下载链接,例如“查看文档”。或者您可以限制允许在表格单元格中显示的字符数。或者您可以查看 word-break 属性(并非在所有浏览器中都可靠)- 请参阅下面的链接以获取文档。

W3Schools - Word-break

关于php 表不完整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19370625/

相关文章:

php - 如何只允许数组中的数据进入输入字段?

php - 具有联系和条件的排名

css - jPlayer circle-player demo 包含分发中未包含的 css 链接

android - 标记元视口(viewport)

css - Bootstrap 3 不支持 IE 8 和 IE 7

php - Htaccess 不适用于 Mamp

php - Ubuntu 上的两个基本 PHP、Apache 问题

php - 对遗留 php 应用程序进行单元测试 — 如何防止意外的数据库调用

css - 剪切部分 Bootstrap 文件并将其复制到自定义 css 文件中是常见的做法吗?

html 图例标签探索不工作中心