【问题标题】:show different data from two or more queries in a simple form PHP以简单的形式 PHP 显示来自两个或多个查询的不同数据
【发布时间】:2017-11-23 10:26:04
【问题描述】:

我在 linux 上使用 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
}

?>

谁来帮帮我

【问题讨论】:

  • 你想输出两张表的合并数据?
  • 简化这个问题。显示所需输出的示例。
  • 是的,当然,检查

标签: php mysql linux phpmyadmin


【解决方案1】:

类似的,在第一个框中显示计数,第二个显示所有值。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-10
    • 2014-10-15
    • 2020-11-13
    • 1970-01-01
    相关资源
    最近更新 更多