|
 |
|
เมื่อฟิลด์หนึ่งเป็นเป็นไพมารีให้ตารางหนึ่ง อีกตารางมีรหัสการใช้สิทธิ์และชื่อของการใช้สิทธิ์(เช่น สมาชิกทั่วไป แอดมิน ประมาณนี้ค่ะ) |
|
 |
|
|
 |
 |
|
คือว่ามีสองตารางประมาณว่า ตารางหนึ่งมี รหัสสมาชิก และมีรหัสการใช้สิทธิ์ และอีกตารางมีรหัสการใช้สิทธิ์และชื่อของการใช้สิทธิ์(เช่น สมาชิกทั่วไป แอดมิน ประมาณนี้ค่ะ) สามารถทำให้แอดมินกำหนดสิทธิ์แต่ละคนได้แล้ว แต่หน้าที่จะโชว์รายชื่อสมาชิกที่จะมีบอำว่าใครอยู่ตำแหน่งอะไรด้วย ไม่สามารถแสดงชื่อการใช้สิทธิ์ได้ค่ะ มันขึ้นว่า Member เหมือนกันทุกคนเลย (ทุกคนตำแหน่งดียวกันซะงั้น) แก้ไปแก้มาก็ไม่โชว์ซะเลย เลยไม่ทราบว่าตนเองใช้คำสั่งอะไรผิดไปค่ะหรือเปล่ารบกวนช่วยดูให้หน่อยนะคะ
Code (PHP)
$count = 0;
$sql = "select * from tb_member" ;
$result = mysql_query($sql) ;
$num_result = mysql_num_rows($result) ;
$dbarr = mysql_fetch_row($result) ;
$permisid=$dbarr[Permission_ID];
$sql2="select * from tb_userpermiss where Permission_ID = '$permisid'";
$result2=mysql_query ($sql2);
$record2=mysql_fetch_row ($result2);
$id=$dbarr[Permission_ID];
while($dbarr = mysql_fetch_array($result)) {
$count++;
?>
<br>
</font> </p></center>
<table width="450" border="1" align="center" cellpadding="3" cellspacing="1">
<tr bgcolor="#666666">
<td colspan="3"> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><font color="#FFFFFF" size="3" face="MS Sans Serif, Tahoma, sans-serif"><strong> หมายเลขสมาชิก
<?php echo $dbarr['Member_ID'] ; ?> </strong></font></td>
<td><div align="center"><font color="#FFFFFF" size="3" face="MS Sans Serif, Tahoma, sans-serif"></font></div></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3"><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif">
ชื่อ-นามสกุล</font><font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"> :
<?php echo $dbarr['Name'] ; ?> </font></td>
</tr>
<tr>
<td><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif">email</font></td>
<td colspan="2"><font color="#0066FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo "<a href='mailto:$dbarr[email]'>$dbarr[Email]</a>" ; ?></font></td>
</tr>
<tr>
<td><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif">เพศ</font></td>
<td colspan="2"><font color="#0066FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Sex'] ; ?></font></td>
</tr>
<tr>
<td><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif">วันเกิด</font></td>
<td colspan="2"><font color="#0066FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Birth_date']."/".$dbarr['Birth_month']."/".$dbarr['Birth_year'] ; ?></font></td>
</tr>
<tr>
<td><font color="#FFFFFF" size="2" face="MS Sans Serif, Tahoma, sans-serif">อายุ</font></td>
<td colspan="2"><font color="#0066FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Age'] ; ?></font></td>
</tr>
<tr valign="middle" bgcolor="#CCCCCC">
<td colspan="3"> <p align="center"><font color="#FF3300" size="2" face="MS Sans Serif, Tahoma, sans-serif"><strong>
ที่อยู่ ข้อมูลในการติดต่อ</strong></font> </p></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">บ้านเลขที่</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Address'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">อำเภอ</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Amper'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">จังหวัด</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Province'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">รหัสไปรษณีย์</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Zipcode'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">เบอร์โทรศัพท์</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Tel'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">การศึกษา</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Educate'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">อาชีพ</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Job'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">สถานที่ทำงาน</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?php echo $dbarr['Office'] ; ?></font></td>
</tr>
<tr>
<td><font color="#666600" size="2" face="MS Sans Serif, Tahoma, sans-serif">วันที่สมัครสมาชิก</font></td>
<td colspan="2"><font color="#0033FF" size="2" face="MS Sans Serif, Tahoma, sans-serif"><?=$dbarr['Rigis_date'] ; ?></font></td>
</tr>
<tr valign="middle" bgcolor="#666666">
<td> <div align="center"><font color="#0000FF" size="2" face="MS Sans Serif, Tahoma, sans-serif">
<u>สถานะสิทธิ์การใช้งาน</u> </font></div></td>
<td colspan="2"> <div align="center"><font size="2" face="MS Sans Serif, Tahoma, sans-serif"> <?=$record2[PermissionName];?>
</font></div></td>
</tr>
</table>
<?
}
mysql_close();
?>
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2011-03-16 18:06:44 |
By :
Zonza |
View :
803 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้มีสถานะสิทธิ์การใช้งานอย่างเดียวค่ะที่เพี้ยนอยู่
|
 |
 |
 |
 |
Date :
2011-03-16 18:08:31 |
By :
Zonza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณคุณ mr.win นะคะ แต่วิธีนี้ลองแล้วค่ะมันไม่ขึ้นเลยค่ะ ว่างเปล่า
ปล. ขอแปะโค้ดใหม่นะคะ อันข้างบนเป็นเป็นตัวที่ลืม undu ค่ะ(มันผิดอยู่)
Code (PHP)
<?
$sql = "select * from tb_member" ;
$result = mysql_query($sql) ;
$num_result = mysql_num_rows($result) ;
while($dbarr = mysql_fetch_array($result)) {
$permisid=$dbarr[Permission_ID];
$sql2="select * from tb_userpermiss where Permission_ID = '$permisid'";
$result2=mysql_query ($sql2);
$record2=mysql_fetch_row ($result2);
$id=$record2[PermissionName];
?>
|
 |
 |
 |
 |
Date :
2011-03-16 20:42:11 |
By :
Zonza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|