0
我想創建一個使用MYSQL連接搜索兩個表現在我想過濾一些變量,我已經從數據庫調用了。
這個sql查詢得到的一切,並粘貼在我的屏幕上
$sql2 = "select pinfo.*, einfo.*
from profile_info pinfo , education_info einfo
where pinfo.username = einfo.username";
現在我想過濾一些變數,說全名,出生日期,性別,位置,日期和恢復,INSTITUTION_NAME
現在信息保存在兩個表我有寫這個確切的查詢來篩選兩個表是一個問題
profile_info education_info
profile_info有此列 用戶名
file_name
file_size
file_type
tmp_name
photograph_name
photograph_size
photograph_type
photographtmp_name
fullname
address
address2
city
state
email
tel
state_origin
lga
marital_status
dob
和教育信息有這列
username
inst_name
inst_name2
grade
study_course
qualification
other_qualification
completion_year
現在使用MYSQL像我如何能夠過濾得到充足的結果。我已經寫
到目前爲止的代碼看起來像這樣
<?php
if(isset($_POST['search_button']))
{
require_once('inc/config.php');
$con = mysqli_connect($host,$user,$pass,$db) or die ('Cannot Connect: '.mysqli_error());
$sql = "select ";
$result = mysqli_query($con,$sql) or die("Error: ".mysqli_error($con));
while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
echo "
<tr>
<td width=248 align=center>
<font face=Verdana size=2>".$row['fullname']."</font></td>
<td align=center><font face=Verdana size=2>".$row['dob']."</font></td>
<td align=center><font face=Verdana size=2>".$row['gender']."</font></td>
<td align=center><font face=Verdana size=2>".$row['location']."</font></td>
<td align=center><font face=Verdana size=2>
".$row['resume']."</font></td>
</tr>";
}
}
?>