我想检查用户的专业知识并显示他们的网络图。我想使用 LIKE 的原因是因为在 mysql 数据库中,专业知识属性也包含在他们的工作场所中。例如:Petronas 的数据分析师。所以我想检查他们的专长是否是数据分析师并显示他们的网络图。
这是我试过的代码:
<?php
if (isset($_GET['id'])) {
$id = $_GET['id'];
$sql = "SELECT * FROM professional, job, location WHERE PROFESSIONAL_ID LIKE '%$id%' AND PROFESSIONAL_ID=JOB_ID AND JOB_ID = LOCATION_ID " ;
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
echo "
<div class='card'>
<img src='../images/img.png' style='width:100%'>
<h2>".$row['PROFESSIONAL_NAME']."</h2>
<p class='title'><i class='fa fa-briefcase' aria-hidden='true'></i> ".$row['JOB_NAME']."</p>
<p class='marker'><i class='fa fa-map-marker' aria-hidden='true'></i> ".$row['LOCATION_NAME']."</p>
<a href=".$row['PROFESSIONAL_URL']."><p><button>Contact</button></p></a>
</div>
<div class='network'>
<h2> Filter Network</h2>
</div>
<div class='filter'>
<input type='radio' value='Expertise' unchecked name='radioBtn' onclick='checkexpertise(".$row['JOB_NAME'].")'> <label> Expertise</label><br>
<input type='radio' value='Location' unchecked name='radioBtn' onclick='checklocation(".$row['LOCATION_NAME'].")'> <label> Location</label><br>
<input type='radio' value='Workplace' unchecked name='radioBtn' onclick='checkworkplace()'> <label> Workplace </label><br>
<input type='radio' value='Past Workplace' unchecked name='radioBtn' onclick='checkpast()'> <label>Past Workplace</label><br>
</div>";
}
?>
<script>
function CheckExpertise (Expertise) {
if Expertise LIKE %Data Analyst% OR %data analyst%
{
window.location.replace("expertise.html");
}
}
</script>
心有法竹
侃侃尔雅