I have a problem, I can't get the result of my code. When I try to debug the code. I using IF statement in my code.
It's just simple, example : if kelas(based on user_id login) = 1, then redirect it to kelas1.php, if kelas = 2, the redirect to kelas 2, else no have a kelas.
Here it's my code :
<?php
session_start();
if(!isset($_SESSION['user_id'])) {
header('Location: form_login_siswa.html');
}
$user_id = $_SESSION['user_id'];
include ("config.php");
$query = "SELECT kelas FROM t_siswa WHERE user_id = '$user_id'";
$hasil = mysql_query($query);
while ($data = mysql_fetch_array($hasil)) {
$kelas = $data['kelas'];
if($kelas = 1) {
include ("kelas1.php");
}
if($kelas = 2) {
include ("kelas2.php");
} else {
echo "Tidak ada kelas";
}
}
?>
Anyone, please help to solve the problem. Appreciated with your helps.
Thank you.