希望你能提供帮助。我正在运行查询,但没有显示任何结果,我只是在尝试将结果字段中的2个链接到另一个时请帮忙吗?
这是我的代码
<?php
include 'core/init.php';
include 'includes/overall/header.php';
?>
<div class="article">
<?php
$result = mysqli_query($con,"SELECT * FROM ref_employees");
while($row = mysqli_fetch_array($result))
if(($user_data['user_id']) == 'employerid'){
{
echo '<h4> ID : '.$row['idnumber'] ;
echo '<br> First Name : '.$row['firstname'];
echo '<br> Last Name : '.$row['lastname'];
echo '<br> Reference 1 : '.$row['ref1'];
echo '<br> Reference 2 : '.$row['ref2'];
echo '<br> Reference 3 : '.$row['ref3'];
echo '<br> Gender : '.$row['gender'];
echo '<br> EMP ID : '.$row['employerid'];
echo '<br> employed : '.$row['employed'];
echo ' </h4>';
include 'includes/adminmenu.php';
}
}
mysqli_close($con);?>
</div>
<?php include 'includes/overall/footer.php';
?>
答案 0 :(得分:0)
这一行:
if(($user_data['user_id']) == 'employerid'){
应该是:
if(($user_data['user_id']) == $row['employerid']){
但如果您需要的话,可以通过查询确切的ID来节省一些资源和代码。
SELECT * FROM ref_employees WHERE employerid={$user_data['user_id']}
你也错放了{在你的while()循环中。
while($row = mysqli_fetch_array($result))
if(($user_data['user_id']) == 'employerid'){
{
应该是:
while($row = mysqli_fetch_array($result))
{
if(($user_data['user_id']) == 'employerid'){