如何获取数据并将其显示在同一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}