我是这里的新手,我有一个问题,如何进行用户角色访问?我对查询选择方法有疑问。
<SELECT NAME="nama" size="1">
<OPTION VALUE="">Sila Pilih
<?
$qNama="SELECT nama,idPekerja FROM pekerja WHERE 1=1";
switch ($levelMenu2) {
case 0:
$qNama .= " AND idPekerja = '$id'";
break;
case 1:
$qNama .= " AND idJabatan = '$idgetJabatan'";
break;
// unit
case 3:
$qNama .= " AND idUnit = '$idunit'";
break;
// subunit
case 4:
$qNama .= " AND idSubUnit = '$idsubunit'";
break;
// lokasi
case 5:
$qNama .= " AND idLokasi = '$idLokasi'";
break;
}
$qNama .= " ORDER BY nama";
$qNama=mysql_query($qNama) or die(mysql_error());
while($rowNama=mysql_fetch_array($qNama)){
?>
<OPTION VALUE="<?=$rowNama['idPekerja'];?>" <?if($idPekerja==$rowNama['idPekerja']){?>selected<?}?>><?=$rowNama['nama']."";
}//while
?>
此代码将显示所有数据。但我只想按部门和部门显示结果。
答案 0 :(得分:-1)
$this->con=mysqli_connect("localhost","****","*******","*****");
$qNama=mysqli_query($this->con,$qNama)
while($rowNama=mysql_fetch_array($qNama)){
?>