|
|
|
รบกวนช่วยดูให้ผมหน่อยครับ ค่า ID ที่ล๊อคอินเปลี่ยน ครับ ช่วยที |
|
|
|
|
|
|
|
ช่วยดูให้ที่ครับ ตรง ค่า <?=$row["name"]?> และ <?=$row["surname"]?> ทำไมถึงหายเวลาเปลี่ยนหน้าครับ
เช็คดูค่า ID ตอนล๊อคอินแล้ว ค่า ID เปลี่ยนเวลากดเข้ามาหน้านี้แล้วเปลี่ยนไปหน้าอื่น
ไม่ทราบเป็นที่อ่ะไรช่วยดูให้หน่อยครับ
<?
ob_start();
session_start();
// Check Login ต้องใส่ส่วนนี้ตลอดเพราะถ้าไม่ใส่เมื่อเราใส่ url โดยการไม่ login จะสามารถเข้ามาได้
if(!isset($_SESSION["id"]))
{
header("location:../home.php") ;
return ;
}
// Prepare Variable
$id = $_SESSION["id"] ;
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../include/connect.php');
// เปิด mysql
$sql = "SELECT * FROM p_member WHERE id = $id" ;
$result = mysql_query($sql) or die(mysql_error()) ;
$row = mysql_fetch_array($result) ;
?>
<!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=windows-874" />
<title>*~ เข้าสู่บทเรียน ~*</title>
</head>
<body onload="MM_preloadImages('../image/news.jpg','../image/news1.jpg','../image/unit1-1.jpg','../image/unit2-1.jpg','../image/unit3-1.jpg','../image/unit4-1.jpg','../image/unit5-1.jpg','../image/unit6-1.jpg','../image/unit7-1.jpg','../image/unit8-1.jpg','../image/unit9-1.jpg','../image/unit10-1.jpg','../image/but/history2.png')">
<table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="57" background="../image/margin2.png"> </td>
<td colspan="2" align="center" valign="top" bordercolor="#000000" bgcolor="#FFFF99"><div align="center">
<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="176" height="170" align="left">
<param name="movie" value="../flash/logo.swf" />
<param name="quality" value="high" />
<embed src="../flash/logo.swf" width="176" height="170" align="left" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>
<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="600" height="170" align="left">
<param name="movie" value="../flash/ban.swf" />
<param name="quality" value="high" />
<embed src="../flash/ban.swf" width="600" height="170" align="left" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>
</object>
</div></td>
<td width="58" background="../image/margin.png"> </td>
</tr>
<tr>
<td width="58" height="76" background="../image/margin2.png"> </td>
<td colspan="2" align="center" valign="top" bgcolor="#FFFF99"><div align="center">
<table width="652" cellpadding="6" cellspacing="1">
<tr>
<th width="636" height="72" scope="col"><a href="../member/menu.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','../image/but/home2.png',1)"><img src="../image/but/home1.png" name="Image1" width="120" height="60" border="0" id="Image1" /></a><a href="../member/history.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','../image/but/history2.png',1)"><img src="../image/but/history1.png" name="Image2" width="120" height="60" border="0" id="Image2" /></a><a href="../member/learn.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','../image/but/lession2.png',1)"><img src="../image/but/lession1.png" name="Image3" width="120" height="60" border="0" id="Image3" /></a><a href="../member/view_member.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','../image/but/member2.png',1)"><img src="../image/but/member1.png" name="Image4" width="120" height="60" border="0" id="Image4" /></a><a href="../member/admin.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','../image/but/WM2.png',1)"><img src="../image/but/WM1.png" name="Image5" width="120" height="60" border="0" id="Image5" /></a></th>
</tr>
</table>
</div></td>
<td width="58" background="../image/margin.png"> </td>
</tr>
<tr>
<td width="58" background="../image/margin2.png"> </td>
<td width="207" align="center" valign="top" bgcolor="#FFFF99"><table width="207" height="1422" cellspacing="1">
<tr>
<th width="201" height="233" align="center" valign="top" scope="col"><table width="199" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#66CC66">
<tr>
<td background="../image/menu02.jpg" bgcolor="#FFFF99"><div align="center"><strong>ยินดีต้อนรับ</strong></div></td>
</tr>
<tr>
<td height="21" bgcolor="#FFFF99"><div align="center" class="style2"><img src="../image/user.gif" width="18" height="18" /> <?=$row["name"]?> <?=$row["surname"]?>
</div></td>
</tr>
</table>
<p> </p>
<table width="199" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#66CC66">
<tr>
<td background="../image/menu02.jpg" bgcolor="#FFFF99"><div align="center"><strong> แบบทดสอบหลังเรียน </strong></div></td>
</tr>
<tr>
<td height="21" bgcolor="#FFFF99"><div align="center">
<table width="174" cellspacing="1">
<tr>
<th width="87" scope="col"><div align="center"><a href="../unit1/test1.php">บทที่ 1</a> </div></th>
<th width="97" scope="col"><div align="center"><a href="test2.php">บทที่ 2</a> </div></th>
</tr>
<tr>
<td><div align="center"><a href="../unit3/test3.php">บทที่ 3</a> </div></td>
<td><div align="center"><a href="../unit4/test4.php">บทที่ 4</a> </div></td>
</tr>
<tr>
<td><div align="center"><a href="../unit5/test5.php">บทที่ 5</a> </div></td>
<td><div align="center"><a href="../unit6/test6.php">บทที่ 6</a> </div></td>
</tr>
<tr>
<td><div align="center"><a href="../unit7/test7.php">บทที่ 7</a> </div></td>
<td><div align="center"><a href="../unit8/test8.php">บทที่ 8</a> </div></td>
</tr>
<tr>
<td><div align="center"><a href="../unit9/test9.php">บทที่ 9</a> </div></td>
<td><div align="center"><a href="../unit10/test10.php">บทที่ 10</a> </div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<p> </p>
<table width="199" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#66CC66">
<tr>
<td background="../image/menu02.jpg" bgcolor="#FFFF99"><div align="center"><strong>เมนูส่วนตัว</strong></div></td>
</tr>
<tr>
<td height="90" align="center" valign="top" bgcolor="#FFFF99"><div align="center">
<table width="200" cellspacing="1">
<tr>
<th scope="col"><div align="center"><img src="../image/file.gif" width="16" height="16" /> <a href="../member/view_member.php">ดูข้อมูลส่วนตัว</a> </div></th>
</tr>
<tr>
<td><div align="center"><img src="../image/edit.gif" width="16" height="16" /> <a href="../member/edit_member.php">แก้ไขข้อมูลส่วนตัว</a> </div></td>
</tr>
<tr>
<td><div align="center"><img src="../image/webboard.gif" width="14" height="12" /> <a href="../member/comment.php">ส่งข้อความถึง admin</a> </div></td>
</tr>
<tr>
<td><div align="center"><strong><img src="../image/im_sm_prefs.gif" width="17" height="17" /> <a href="../member/logout.php">Logout</a></strong></div></td>
</tr>
</table>
</div></td>
</tr>
</table></th>
</tr>
<tr>
<td height="1184" align="center" valign="top"><table width="199" border="0" cellpadding="0" cellspacing="0">
<tr>
</a></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="617" align="center" valign="top" bgcolor="#FFFF99"><table width="586" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#66CC66">
<tr>
<td width="578" background="../image/menu02.jpg" bgcolor="#FFFF99"><div align="center"><strong>แบบทดสอบบทที่ 1 </strong></div></td>
</tr>
<tr>
<td height="51" align="center" valign="top" bgcolor="#FFFF99"><FORM METHOD=POST ACTION="chktest.php">
<table width="466" height="30" cellspacing="1">
<tr>
<th width="460" height="26" align="left" valign="top" scope="col"><?
$number=1;
//include "connect.php";
$sql="select * from p_test1 order by id";
$result=mysql_db_query("$dbname",$sql);
while ($r=mysql_fetch_array($result)) {
$id=$r[id];
$question=$r[question];
$choice1=$r[choice1];
$choice2=$r[choice2];
$choice3=$r[choice3];
$choice4=$r[choice4];
echo "<B>ข้อ $number. $question </B><BR>
<INPUT TYPE='radio' NAME='select_$id' VALUE='1'> $choice1 <BR>
<INPUT TYPE='radio' NAME='select_$id' VALUE='2'> $choice2 <BR>
<INPUT TYPE='radio' NAME='select_$id' VALUE='3'> $choice3 <BR>
<INPUT TYPE='radio' NAME='select_$id' VALUE='4'> $choice4
<HR>
";
$number++;
}
?>
<input name="submit" type="submit" value="ตรวจข้อสอบ" />
<input name="reset" type="reset" value="ยกเลิก" /></th>
</tr>
</table>
<BR>
</FORM></td>
</tr>
</table> <p align="center"> </p> </td>
<td width="58" background="../image/margin.png"> </td>
</tr>
<tr>
<td width="58" background="../image/margin2.png"> </td>
<td colspan="2" bgcolor="#FFFF99"><img src="../image/foot.gif" alt="ผู้จัดทำเว็บไซต์" width="824" height="50" /></td>
<td width="58" background="../image/margin.png"> </td>
</tr>
</table>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2010-12-07 01:43:13 |
By :
artcomclub |
View :
853 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$sql = "SELECT * FROM p_member WHERE id = $id" ;
echo $sql;
ลงอตรวจสอบดูน่ะครับว่ามันมีค่า Session หรือเปล่าน่ะครับ
|
|
|
|
|
Date :
2010-12-07 06:37:33 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|