ช่วยดูให้หน่อยค่ะ คือดึงข้อมูลใน TB ขึ้นมาจาแสดงเพิ่ยงแค่คนเดียวแตไม่รู้ทำไมข้อมูลแสดงขึ้นมาทั้งหมดในฐานข้อมูล
Code (PHP)
<?
include "connect.php";
$sql = "select * from staff a, position b where a.position_id = b.position_id ";
$rst = mysql_query($sql);
$nrow = mysql_num_rows($rst);
$arr = mysql_fetch_array($rst);
echo $arr["xxxx"];
?>
Date :
2011-09-08 16:37:33
By :
webmaster
ทำไมไม่ได้ค่ะ ระบบจะแสดงรายละเอียดข้อมูลชื่อผู้ใช้เพียงคนแค่คนเดียว ไม่ว่าจะเลือกผู้ใช้คนไหนก้อจะแสดงข้อมูลของคนเดียว
เช่น เลือก ก แสดงข้อมูล ก
เลือก ข แสดงข้อมูล ก
ไม่ทราบว่าผิดพลาดตรงไหนค่ะ
ช่วยตอบหน่อยน่ะค่ะ
Date :
2011-09-08 16:57:53
By :
nooaoy
กำหนด LIMIT ครับ
Code (PHP)
$sql = "select * from staff a, position b where a.position_id = b.position_id LIMIT 1 ";
Date :
2011-09-08 16:59:42
By :
arm8957
โชข้อมูล แค่ 1 คนแล้ว แต่พอเลือกดูรายละเอียดข้อมูลแต่ละคน ยังเป็นข้อมูลของคนแรกอยู่
ไม่ทราบว่ามันเกิดจากอารายค่ะ
Date :
2011-09-08 17:05:11
By :
nooaoy
<? session_start();
$sess_staffid=$_SESSION[sess_staffid];
$sess_stafflogin=$_SESSION[sess_stafflogin];
if ($sess_staffid<>session_id() or $sess_stafflogin=="") {
header( "Location:login_index.php");
include ("connect.php");
exit();
}
?>
<?
include "connect.php";
$sql = "select * from staff a, position b where a.position_id = b.position_id LIMIT 1 ";
//$sql = "select * from staff a, position b where a.position_id = b.position_id ";
$rst = mysql_query($sql);
$nrow = mysql_num_rows($rst);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ระบบยืม-คืนอุปกรณ์เครื่องเสียง</title>
<link href="../style3.css" rel="stylesheet" type="text/css" />
<SCRIPT LANGUAGE="JavaScript" SRC="CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">// Code popup ปฎิทินจ้าาา
var cal = new CalendarPopup();
</SCRIPT>
<script language="javascript">//CODE รูปแบบการกรอกข้อมูลเป็นตัวเลขเท่านั้น
function CheckNum(){
if (event.keyCode < 48 || event.keyCode > 57){
event.returnValue = false;
}
}
</script>
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.style10 {font-size: 24px}
.style11 {color: #FF0000}
.style12 {color: #000000}
-->
</style>
<script src="../../../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body onload="MM_preloadImages('../images/menu/images/menu1_03.jpg','../images/menu/images/menu1_05.jpg','../images/menu/images/menu1_08.jpg','../images/menu/images/menu1_10.jpg','../images/menu/images/menu1_12.jpg','../images/menu/images/menu1_14.jpg','../images/menu/images/menu1_16.jpg','../images/menu/images/menu1_17.jpg','../images/menu/images/menu1_19.jpg','../images/menu/images/menu1_21.jpg')">
<div id="wrapper">
<div id="contaner">
<div id="line"></div>
<div id="contaner2">
<div id="Header">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','900','height','220','src','../images/flashhead','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','../images/flashhead' ); //end AC code
</script>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="900" height="220">
<param name="movie" value="../images/flashhead.swf" />
<param name="quality" value="high" />
<embed src="../images/flashhead.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="900" height="220"></embed>
</object>
</div>
<div id="content">
<div class="content">
<div align="right"class="contfirst"> ผู้ใช้คุณ : <?=$sess_stafflogin?> | <? include ("time.php") ?> </div>
<div class="contsecount">
<div class="contindex1-left">
<div class="contindex1-left1-list"><img src="../images/mainmenu.jpg" /></div>
<div class=" contindex1-left1-list1"><a href="s_index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','../images/menu/menu1.jpg',1)"><img src="../images/menu/menu01.jpg" name="Image2" width="198" height="31" border="0" id="Image2" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_member_conform.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','../images/menu/menu6.jpg',1)"><img src="../images/menu/menu06.jpg" name="Image3" width="198" height="31" border="0" id="Image3" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_borrow.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','../images/menu/menu11.jpg',1)"><img src="../images/menu/menu011.jpg" name="Image4" width="198" height="31" border="0" id="Image4" /></a></div>
<div class=" contindex1-left1-list1"><img src="../images/menu/headmenu01.jpg" width="197" height="32" /></div>
<div class=" contindex1-left1-list1"><a href="s_staff.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','../images/menu/menu2.jpg',1)"><img src="../images/menu/menu02.jpg" name="Image6" width="198" height="31" border="0" id="Image6" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_staff_edit.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','../images/menu/menu3.jpg',1)"><img src="../images/menu/menu03.jpg" name="Image7" width="198" height="31" border="0" id="Image7" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_staff_edit_pass.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','../images/menu/menu4.jpg',1)"><img src="../images/menu/menu04.jpg" name="Image8" width="198" height="31" border="0" id="Image8" /></a></div>
<div class=" contindex1-left1-list1"><img src="../images/menu/headmenu02.jpg" width="196" height="32" /></div>
<div class=" contindex1-left1-list1"><a href="s_device.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','../images/menu/menu7.jpg',1)"><img src="../images/menu/menu07.jpg" name="Image10" width="198" height="31" border="0" id="Image10" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_news.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','../images/menu/menu8.jpg',1)"><img src="../images/menu/menu08.jpg" name="Image11" width="198" height="31" border="0" id="Image11" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_datail_staff.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image22','','../images/menu/staff1-2.jpg',1)"><img src="../images/menu/staff1-1.jpg" name="Image22" width="198" height="31" border="0" id="Image22" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_position.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image23','','../images/menu/position1-2.jpg',1)"><img src="../images/menu/position1-1.jpg" name="Image23" width="198" height="31" border="0" id="Image23" /></a></div>
<div class=" contindex1-left1-list1"><img src="../images/menu/headmenu03.jpg" width="196" height="32" /></div>
<div class=" contindex1-left1-list1"><a href="s_report_interval.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image14','','../images/menu/menu12.jpg',1)"><img src="../images/menu/menu012.jpg" name="Image14" width="198" height="31" border="0" id="Image14" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_report_nosent.php" target="_blank" onmouseover="MM_swapImage('Image15','','../images/menu/menu13.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="../images/menu/menu013.jpg" name="Image15" width="198" height="31" border="0" id="Image15" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_report_month.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image16','','../images/menu/menu14.jpg',1)"><img src="../images/menu/menu014.jpg" name="Image16" width="198" height="31" border="0" id="Image16" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_report_sent.php" target="_blank" onmouseover="MM_swapImage('Image17','','../images/menu/menu15.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="../images/menu/menu015.jpg" name="Image17" width="198" height="31" border="0" id="Image17" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_report_device.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image18','','../images/menu/menu016.jpg',1)"><img src="../images/menu/menu16.jpg" name="Image18" width="198" height="31" border="0" id="Image18" /></a></div>
<div class=" contindex1-left1-list1"><a href="s_report_user.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image19','','../images/menu/menu17.jpg',1)"><img src="../images/menu/menu017.jpg" name="Image19" width="198" height="31" border="0" id="Image19" /></a></div>
<div class=" contindex1-left1-list1"><a href="logout1.php"></a><a href="logout1.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image21','','../images/menu/logout_1.jpg',1)"><img src="../images/menu/logout.jpg" name="Image21" width="198" height="31" border="0" id="Image21" /></a></div>
<div class=" contindex1-left1-list2"></div>
</div>
<div class="contindex1-right">
<p><br />
<br />
</p>
<p> </p>
<table width="604" border="0" align="center">
<tr>
<td width="598"><div align="center" class="style10">รายละเอียดข้อมูลเจ้าหน้าที่</div></td>
</tr>
</table>
<p> </p>
<div align="center">
<form name="formdatail" method="post" enctype="multipart/form-data" onSubmit="return check();"
action="s_datail_staff2.php">
<table width="561" border="0" cellspacing="0">
<? while ($arr = mysql_fetch_array($rst)) { ?>
<tr>
<td width="112" height="34"> </td>
<td width="202"><div align="left">ชื่อเจ้าหน้าที่ : </div></td>
<td height="34" colspan="2"><div align="left"> <? echo $arr[staff_name]?> <? echo $arr[staff_surname]?></div> <div align="left"></div></td>
</tr>
<tr>
<td> </td>
<td><div align="left">ที่อยู่ :</div></td>
<td height="38" colspan="2"><div align="left"><? echo $arr[staff_address]?></div> <div align="left"></div></td>
</tr>
<tr>
<td> </td>
<td><div align="left">ตำบล : </div></td>
<td height="36" colspan="2"><div align="left"><? echo $arr[staff_thambon]?></div> <div align="left"></div></td>
</tr>
<tr>
<td height="35"> </td>
<td><div align="left">อำเภอ : </div></td>
<td colspan="2"><div align="left"><? echo $arr[staff_ampher]?></div> <div align="left"></div></td>
</tr>
<tr>
<td height="38"> </td>
<td><div align="left">จังหวัด : </div></td>
<td colspan="2"><div align="left"><? echo $arr[staff_provice]?> <? echo $arr[staff_code]?></div> <div align="left"></div></td>
</tr>
<tr>
<td height="41"> </td>
<td><div align="left">ตำแหน่ง : </div></td>
<td colspan="2"><div align="left">
<span class="style11"></span><? echo $arr[position_name]?> </div></td>
</tr>
<tr>
<td height="43"> </td>
<td><div align="left">ประเภทเจ้าหน้าที่ : </div></td>
<td colspan="2"><div align="left"><span class="style11"></span> <? if ($arr[staff_num]=="1"){
echo "ADMINISTRATOR";
}else{
echo "STAFF";
}
?> </div></td>
</tr>
<tr>
<td height="41"> </td>
<td><div align="left">วันที่เข้าทำงาน : </div></td>
<td colspan="2"><div align="left"><? echo $arr[date_start]?></div> <div align="left"> </div></td>
</tr>
<tr>
<td height="35"> </td>
<td><div align="left">ชื่อเข้าใช้งานระบบ : </div></td>
<td colspan="2"><div align="left"><? echo $arr[staff_login]?> </div> <div align="left"></div></td>
</tr>
<tr>
<td height="30"> </td>
<td><div align="left">รหัสผ่าน : </div></td>
<td colspan="2"><div align="left"><? echo $arr[staff_password]?></div> <div align="left"></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="92"> </td>
<td width="147"> </td>
</tr>
<? } ?>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<div id="footer"> </div>
</div>
<div id="line2"></div>
</div>
</div>
</body>
</html>
ช่วยดูให้หน่อยน่ะค่ะว่าเขียนผิดตรงไหนหรือป่าว
Date :
2011-09-08 17:08:09
By :
nooaoy
พี่ๆๆจ๋าาาาาาช่วยดูให้หน่อยจิ
ว่าผิดตรงไหน
ทำไมถึงแสดงข้อมูลของคนเดิมตลอด
Date :
2011-09-08 23:43:43
By :
nooaoy
Load balance : Server 03