2017-06-20 37 views
0

我在linux上的php窗體中工作,當我嘗試在兩個不同的表和兩個不同的查詢中顯示信息時,頂部顯示記錄數量,第二個顯示所有記錄。以簡單的形式顯示來自兩個或多個查詢的不同數據PHP

<?php 
     include_once 'dbcon.php'; 
?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Monitoring</title> 
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" /> 
<script src="jquery.js" type="text/javascript"></script> 
<script src="js-script.js" type="text/javascript"></script> 
</head> 

<body> 

    </div> 
</div> 
<div class="clearfix"></div> 

<div class="container"> 
<a href="generate.php" class="btn btn-large btn-info"><i class="glyphicon glyphicon-plus"></i> &nbsp; Add Records</a> 
</div> 

<div class="clearfix"></div><br /> 



<div class="container"> 
<form method="post" name="frm"> 
<table class='table table-bordered table-responsive'> 
<tr> 
<th>number</th> 
</tr> 

<div class="container"> 
<form method="post" name="frm"> 
<table class='table table-bordered table-responsive'> 
<th>contry</th> 
<th>id</th> 
<th>Name</th> 
<th>core</th> 
<th>size</th> 
<th>type</th> 
<th>Status</th> 
<th>date</th> 
</tr> 
<?php 
     $res = $MySQLiconn->query("select * table ;"); 
     $count = $res->num_rows; 

     if($count > 0) 
     { 
       while($row=$res->fetch_array()) 



$res2 = $MySQLiconn->query("select COUNT(id) as number from table2;"); 
     $count1 = $res2->num_rows; 
     if($count1 > 0) 
     { 
     while($row1=$res2->fetch_array()) 

{ 
         ?> 
         <tr> 
         <td><?php echo $row1['number']; ?></td> 
          <?php 
        ?><tr> 
         <td><?php echo $row['contry']; ?></td> 
         <td><?php echo $row['id']; ?></td> 
         <td><?php echo $row['name']; ?></td> 
         <td><?php echo $row['core']; ?></td> 
         <td><?php echo $row['size']; ?></td> 
         <td><?php echo $row['type']; ?></td> 
         <td><?php echo $row['status']; ?></td> 
         <td><?php echo $row['date']; ?></td> 
         </tr> 
         <?php 

} 
} 
     } 
     else 
     { 
       ?> 
     <tr> 
     <td colspan="3"> No Records Found ...</td> 
     </tr> 
     <?php 
     } 
?> 

<?php 

if($count > 0) 
{ 
     ?> 

    <?php 
} 

?> 

有人幫助我

+0

你想輸出兩個表的組合數據? –

+0

簡化這個問題。顯示所需輸出的示例。 – mkaatman

+0

是的,當然,檢查 – Dorian

回答

0

類似的東西,在第一個框中顯示計數和第二場演出的所有值。

enter image description here

相關問題