如何通过从表selected_val ==1
中提取selected_candidate
来突出显示员工表行,我只想突出显示 selected_val is 1
的行
selected_candidate
表的结构是
eid int(30)
rid int(30)
selected_val int(1)
我正在使用此查询在表单上显示员工表
$query = "SELECT eid,ename,lname,ecell,eposition,eemail,ecountry,estate,ecity,prefcities,ca,cs,cwa,completed,persuing,other_work1,other_work2,other_work3,other_work4,other_work5,other_work6,other_work7,other_work8,selected_val";
$query .= "FROM employee INNER JOIN selected_candidate ON employee.eid = selected_candidate.eid";
$query .= "WHERE efamiliar LIKE '%{$company}%' ";
和这个PHP代码
<?php
if(isset($_POST['Submit']))
{
//$url="down.php?location={$location}&status={$status}&company={$company}&qr={$qr}&flag={$flag}&count={$count}";
$i=0;
while($data_set = mysql_fetch_array($result_set))
{
$i=0;
echo "<div id=\"Message1[$i]\" class=\"box\">";
echo "Country ={$data_set['ecountry']}<br/>";
echo "State = {$data_set['estate']}<br/>";
echo "</div>";
echo "<tr>";
echo "<td><input id=\"select_candi{$i}\" onclick=\"javascript:func(this.id,{$_SESSION['uid']})\" type=\"checkbox\" name=\"check_candi[]\" value=\"{$data_set['eid']}\"/></td>";
echo "<td>{$data_set['ename']}</td>";
echo "<td>{$data_set['lname']}</td>";
echo "<td>{$data_set['ecell']}</td>";
echo "<td>{$data_set['eposition']}</td>";
echo "<td>{$data_set['eemail']}</td>";
if($data_set['ecity']=='')
{
echo "<td>{$data_set['ecountry']}</td>";
}
else
{
echo "<td onmouseover=\"ShowText('Message1[$i]'); return true;\" onmouseout=\"HideText('Message1[$i]'); return true;\" href=\"javascript:ShowText('Message1')\">{$data_set['ecity']}</td>";
}
// echo "<td>{$data_set['ecountry']},{$data_set['estate']},{$data_set['ecity']}</td>";
echo "<td>{$qua}</td>";
echo "<td>{$data_set['other_work1']} {$data_set['other_work2']}{$data_set['other_work3']}{$data_set['other_work4']} {$data_set['other_work5']} {$data_set['other_work6']} {$data_set['other_work7']} {$data_set['other_work8']} {$data_set['other_work9']} {$data_set['other_work10']}
{$data_set['other_work1e']} {$data_set['other_work2e']} {$data_set['other_work3e']} {$data_set['other_work4e']} {$data_set['other_work5e']} {$data_set['other_work6e']} {$data_set['other_work7e']} {$data_set['other_work8e']} {$data_set['other_work9e']} {$data_set['other_work10e']}
</td>";
echo "<td><a href=\"detailcv.php?id={$data_set['eid']}\" target=\"_blank\"><input style=\" cursor:hand;width:40px\" class=\"button\" name=\"cv\" type=\"button\" value=\"C V\" /></a></td>";
echo "</tr>";
$i++;
}
}
?>
答案 0 :(得分:0)
JOIN
两个表Employee
和selected_candidate
,如下所示:
SELECT
eid, ename, lname, ecell,
eposition, eemail, ecountry, estate,
ecity, prefcities, ca, cs ,
cwa, completed, persuing, other_work1,
other_work2, other_work3, other_work4,
other_work5, other_work6, other_work7,
other_work8,
selected_val -- <<<<<<<<<<<<<<<<
FROM employee
INNER JOIN selected_candidate ON employee.eid = selected_candidate.eid
WHERE efamiliar LIKE '%{$company}%';
然后您可以选择selected_val
。稍后,使用来自前端应用程序的PHP,您可以测试此值是否为== 1
,即突出显示它。
旁注:您的表格不是normalized。您可以将other_work
列移动到新表中,并使用外键对该列进行操作。