-1

my question is: the query needs to check if id = 1 then show all the person which have that number., im fairly new to this so I hope you guys can help me.

<?php
include("header.php");
include("checklogin.php");
include('menu.php');

$groep = $_SESSION['groep'];
$naam = $_SESSION['inlognaam'];

$qryGebruikers1="SELECT student.klas_id, gebr.id, gebr.inlognaam, gebr.wachtwoord, rol.naam as rol from gebruiker as gebr
                WHERE studen.klas_id = '1'
                inner join rol on gebr.rol_id=rol.id
                order by gebr.inlognaam;";

$result1=mysqli_query($conn,$qryGebruikers1);

if ($groep == 'verzekering' && $naam == 'verzekering2') 
        {
            echo 'U bent verzekering 2';
        }

(this is in a table) | /


?>


    while  ($row1=mysqli_fetch_array($result1))
    {

        if ($groep == 'verzekering' && $naam == 'verzekering1' )
        {
                    echo '<tr>
                    <td>'.$row1["inlognaam"].'</td>
                    <td>'.$row1["rol"].'</td>
                    <td><a href="changeuser.php?id='.$row1["id"].'&action=edit"><img src="images/edit.png" alt="Wijzigen" style="border: 0px;" /></a></td>
                    <td><a href="changeuser.php?id='.$row1["id"].'&action=delete"><img src="images/drop.png" alt="Verwijderen" style="border: 0px;" /></a></td>
                    </tr>';
        }
    }

?>

I tried to switch inner join and where

Bob
  • 1
  • 1

1 Answers1

0

First You are accessing table STUDEN but Seems you missed a join for STUDEN table

could be you need a JOIN for this table too

    SELECT student.klas_id
    , gebr.id
    , gebr.inlognaam
    , gebr.wachtwoord
    , rol.naam as rol 
    from gebruiker as gebr
    inner join rol on gebr.rol_id=rol.id
    INNER JOIN studen ON  stunded.key_col =  table_related.key_col  // <----- this 
    AND studen.klas_id = '1'
    order by gebr.inlognaam;

second usually the id are integer and you are using string if the id is an integer the condition should not use quotes

   AND studen.klas_id = 1 
Onkar Musale
  • 909
  • 10
  • 25
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
  • where is the student.klas_id student table,he didnt mention it – Deepak A Apr 08 '19 at 10:56
  • 1
    'INNER JOIN studen ON stunded.key_col = table_related.key_col ' ,this question is not complete.Please mark the question as hold – Deepak A Apr 08 '19 at 10:57
  • @Deepak .. the OP is a new contributor.. instead of an hurry for flag the query as wrong on unclear i prefer post an aswer that show the issue – ScaisEdge Apr 08 '19 at 11:00