Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何获取数据并将其显示在同一php页面中_Php_Jquery_Mysql - Fatal编程技术网

如何获取数据并将其显示在同一php页面中

如何获取数据并将其显示在同一php页面中,php,jquery,mysql,Php,Jquery,Mysql,我想在单击另一个表的行时从同一页中的一个表中获取一些数据 下面是我正在尝试做的事情的代码,我被卡住了: <?php $db_table="area"; $db_query='select areaid,area_name from ' . $db_table; $query_result=mysqli_query($dbc,$db_query) or die('error querying db');?> <div id="area1" > <h3&g

我想在单击另一个表的行时从同一页中的一个表中获取一些数据

下面是我正在尝试做的事情的代码,我被卡住了:

<?php
$db_table="area";  
$db_query='select areaid,area_name from ' . $db_table;
$query_result=mysqli_query($dbc,$db_query) or die('error querying db');?>

<div id="area1" >
    <h3>Select ony two area from Category </h3>
         <form>
             <fieldset style="float: left; width: 25%">
                  <legend>Project Area</legend>
                      <table border=1>
                         <tr> 
                            <th> </th>
                            <th> Area Name </th>
                         </tr>
                      <?php 
                        while($row=mysqli_fetch_array($query_result)){ 
                      ?>
                         <tr id="<?php echo $row['areaid'];?>" class="area" onlick="showfaculty()">
                              <td> <input class="selectarea" type="radio"  name = "proarea" value="<?php echo $row['areaid'];?>"></td>
                              <td> <?php echo $row['area_name']; ?></td>
                        </tr>

                        <?php }
                         echo '</table></br></br>
          </fieldset>

          <fieldset id="avaguide" style="width: 25%">
                   <legend>Available Guide</legend>
                        <table border=1>
                             <tr> 
                                <th> </th>
                                 <th> Available Guides </th>
                             </tr>';
                            $db_table2="facultytable"; 
                            $db_query='select facultyID,facultName from ' .                       $db_table2.' where project_count<2';
                            $query_result=mysqli_query($dbc,$db_query) or die('error querying db');
                            while($row=mysqli_fetch_array($query_result)){
                            ?>
                            <tr id="<?php echo $row['facultyID'];?>" class="area">
                                   <td> <input class="selectguide" type="radio"  name = "areaguide" value="<?php echo $row['facultyID'];?>"></td>
                                   <td> <?php echo $row['facultName']; ?></td>
                    </tr>
                     <?php }        
                        echo '</table></fieldset>

                   </form>
            </div>;`

请告诉我怎么做。

在我看来,完成这项任务的最佳方法是使用AJAX,或者您可以使用JS和PHP上的RESTful服务构建一个页面应用程序。我喜欢AngularJS作为前端

请努力帮助他人理解您的问题。粘贴在这里表格结构和格式你的文本好。你的代码是什么呢?或者,您是要我们为您编码吗?请不要期望下面会出现神奇的答案。这不是“堆栈如何滚动”。欢迎来到SO。请阅读,所以这不是免费的编码服务
function showFaculty($aeraid){
         $db_table2="faculty_area"; 
         $db_query='select f_id from ' . $db_table2.' where a_id = '.$areaid;
         $query_result=mysqli_query($dbc,$db_query) or die('error querying db');
         while($row=mysqli_fetch_array($query_result)){ some code that can be used to display faculty table with feteched f_id}