|
|
|
ดู ให้หน่อยครับ ว่า มัน ผิด ตรงไหน เพราะ ผม ลอง ทำใน mysql แล้ว มัน ก็ ขึ้น แต่ พอ มา ทำ ใน dream แล้ว มัน เป็น อะไร ก็ ไม่ รู้ ครับ |
|
|
|
|
|
|
|
งง ครับ ดู ให้ ที่ ครับว่ามันผิดตรงไหน หรือ ควรจะ แก้หรือปรับปรุงตรงไหนดีครับ
Code (PHP)
<?php session_start();
if(!session_is_registered('loginname')){
header("location:formlogin.php");
}
echo $_SESSION['loginname'];
echo $_SESSION['pw'];
$name = $_SESSION['loginname'];
$pass = $_SESSION['pw'];
echo $pass ;
echo $name;
?>
<?
$host="localhost";
$user="root";
$pw="12345";
$db="rimes1";
mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_query("set NAMES tis620");
$result = mysql_select_db($db) or die(mysql_error());
?>
<!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>Untitled Document</title>
</head>
<body>
<center>
<p>
</p>
<table width="1342" height="216" border="1">
<tr>
<td height="96" colspan="13">Edit Table</td>
</tr>
<tr>
<td width="43" align="center" valign="middle">NO.</td>
<td width="21" align="center" valign="middle">User_id</td>
<td width="21" align="center" valign="middle">DAY</td>
<td width="117" height="47" align="center" valign="middle">Nomal date</td>
<td width="133" align="center" valign="middle">Nomal time in</td>
<td width="141" align="center" valign="middle">Nomal time Out</td>
<td width="125" align="center" valign="middle">Shift date </td>
<td width="128" align="center" valign="middle">shift time in </td>
<td width="130" align="center" valign="middle">shift date time out</td>
<td width="111" align="center" valign="middle">shift time out</td>
<td width="139" align="center" valign="middle">Detail</td>
<td width="139" align="center" valign="middle">Edit</td>
<td width="20" align="center" valign="middle">Delete</td>
</tr>
<?
$sql = "select id,day,time_sheet_table.user_id,
DATE_FORMAT(n_timein,'%H:%i') as ntimein,
DATE_FORMAT(n_timeout,'%H:%i')as ntimeout,
DATE_FORMAT(n_timein,'%Y-%m-%d') As n_date,
DATE_FORMAT(s_timein,'%Y-%m-%d') As s_date_timein,
DATE_FORMAT(s_timeout,'%Y-%m-%d') As s_date_out,
DATE_FORMAT(s_timein,'%H:%i') as stimein,
DATE_FORMAT(s_timeout,'%H:%i') as stimeout,detail
from time_sheet_table ,user_table
where user_table.user_id = time_sheet_table.user_id
and username = '$name' and password = '$pass'
";
$nongA = mysql_query($sql);
while ($test =mysql_fetch_array($nongA)){
?>
<tr>
<td width="43" align="center" valign="middle"><? echo $test['id']?></td>
<td width="21" align="center" valign="middle"><? echo $test['user_id'];?></td>
<td width="21" align="center" valign="middle"><? echo $test['day']; ?></td>
<td><? echo $test['n_date'];?></td>
<td><? echo $test['ntimein'];?></td>
<td><? echo $test['ntimeout'];?></td>
<td><? echo $test['s_date_timein'];?></td>
<td width="128"><? echo $test['stimein'];?></td>
<td width="130" align="center" valign="middle"><? echo $test['s_date_out'];?></td>
<td width="111" align="center" valign="middle"><? echo $test['stimeout'];?></td>
<td width="139" align="center" valign="middle"><? echo $test['detail'];?></td>
<td width="139" align="center" valign="middle"><a href="edit1.php?id=<? echo $test['id']?>">Edit</a></td>
<td width="20" align="center"><a href="delete.php?id=<? echo $test['id']?>">Delete</a></td>
</tr>
<? } ?>
</table>
</center>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-04-20 11:01:29 |
By :
macro |
View :
723 |
Reply :
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error อะไรครับ
|
|
|
|
|
Date :
2011-04-20 11:23:30 |
By :
silasakk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันไม่ได้ error ครับ แต่ มัน ไม่แสดง ผม ออกมา อ่ะครับ ผม เลย งง ว่าม ัน เป็น อะไร พอ ผม echo number of rows ออก มา มัน ก็ ได้ 3 เท่า กัน จำนวน ใน my sql น่ะครับ ผม เลย งง ว่า ควรทำยังไง ดี
|
|
|
|
|
Date :
2011-04-20 11:28:19 |
By :
macro |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เช็คค่า $name กับ $pass แล้วมีค่าส่งมาหรือเปล่าค่ะ
ลองแบบนี้ดูหรือยังค่ะ
<?php session_start();
if(!session_is_registered('loginname')){
header("location:formlogin.php");
}
echo $_SESSION['loginname'];
echo $_SESSION['pw'];
$name = $_SESSION['loginname'];
$pass = $_SESSION['pw'];
echo $pass ;
echo $name;
?>
<?
$host="localhost";
$user="root";
$pw="12345";
$db="rimes1";
mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_query("set NAMES tis620");
$result = mysql_select_db($db) or die(mysql_error());
?>
<!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>Untitled Document</title>
</head>
<body>
<center>
<p>
</p>
<table width="1342" height="216" border="1">
<tr>
<td height="96" colspan="13">Edit Table</td>
</tr>
<tr>
<td width="43" align="center" valign="middle">NO.</td>
<td width="21" align="center" valign="middle">User_id</td>
<td width="21" align="center" valign="middle">DAY</td>
<td width="117" height="47" align="center" valign="middle">Nomal date</td>
<td width="133" align="center" valign="middle">Nomal time in</td>
<td width="141" align="center" valign="middle">Nomal time Out</td>
<td width="125" align="center" valign="middle">Shift date </td>
<td width="128" align="center" valign="middle">shift time in </td>
<td width="130" align="center" valign="middle">shift date time out</td>
<td width="111" align="center" valign="middle">shift time out</td>
<td width="139" align="center" valign="middle">Detail</td>
<td width="139" align="center" valign="middle">Edit</td>
<td width="20" align="center" valign="middle">Delete</td>
</tr>
<?
$sql = "select id,day,time_sheet_table.user_id,
DATE_FORMAT(n_timein,'%H:%i') as ntimein,
DATE_FORMAT(n_timeout,'%H:%i')as ntimeout,
DATE_FORMAT(n_timein,'%Y-%m-%d') As n_date,
DATE_FORMAT(s_timein,'%Y-%m-%d') As s_date_timein,
DATE_FORMAT(s_timeout,'%Y-%m-%d') As s_date_out,
DATE_FORMAT(s_timein,'%H:%i') as stimein,
DATE_FORMAT(s_timeout,'%H:%i') as stimeout,detail
from time_sheet_table ,user_table
where user_table.user_id = time_sheet_table.user_id
and username = '$name' and password = '$pass'
";
$result = mysql_query($sql);
while ($rows =mysql_fetch_array($result )){
?>
<tr>
<td width="43" align="center" valign="middle"><?=$rows['id']?></td>
<td width="21" align="center" valign="middle"><?=$rows['user_id'];?></td>
<td width="21" align="center" valign="middle"><?=$rows['day']; ?></td>
<td><?=$rows['n_date'];?></td>
<td><?=$rows['ntimein'];?></td>
<td><?=$rows['ntimeout'];?></td>
<td><?=$rows['s_date_timein'];?></td>
<td width="128"><?=$rows['stimein'];?></td>
<td width="130" align="center" valign="middle"><?=$rows['s_date_out'];?></td>
<td width="111" align="center" valign="middle"><?=$rows['stimeout'];?></td>
<td width="139" align="center" valign="middle"><?=$rows['detail'];?></td>
<td width="139" align="center" valign="middle"><a href="edit1.php?id=<?=$rows['id']?>">Edit</a></td>
<td width="20" align="center"><a href="delete.php?id=<?=$rows['id']?>">Delete</a></td>
</tr>
<? } ?>
</table>
</center>
</body>
</html>
|
|
|
|
|
Date :
2011-04-20 11:49:48 |
By :
ติ๊ก |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php session_start();
if(!session_is_registered('loginname')){
header("location:formlogin.php");
}
echo $_SESSION['loginname'];
echo $_SESSION['pw'];
$name = $_SESSION['loginname'];
$pass = $_SESSION['pw'];
echo $pass ;
echo $name;
?>
<?
$host="localhost";
$user="root";
$pw="12345";
$db="rimes1";
mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_query("set NAMES tis620");
$result = mysql_select_db($db) or die(mysql_error());
?>
<!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>Untitled Document</title>
</head>
<body>
<center>
<p>
</p>
<table width="1342" height="172" border="1">
<tr>
<td height="96" colspan="13">Edit Table</td>
</tr>
<tr>
<td width="43" align="center" valign="middle">NO.</td>
<td width="21" align="center" valign="middle">User_id</td>
<td width="21" align="center" valign="middle">DAY</td>
<td width="117" height="33" align="center" valign="middle">Nomal date</td>
<td width="133" align="center" valign="middle">Nomal time in</td>
<td width="141" align="center" valign="middle">Nomal time Out</td>
<td width="125" align="center" valign="middle">Shift date </td>
<td width="128" align="center" valign="middle">shift time in </td>
<td width="130" align="center" valign="middle">shift date time out</td>
<td width="111" align="center" valign="middle">shift time out</td>
<td width="139" align="center" valign="middle">Detail</td>
<td width="139" align="center" valign="middle">Edit</td>
<td width="20" align="center" valign="middle">Delete</td>
</tr>
<?
$sql = "select id,day,time_sheet_table.user_id,
DATE_FORMAT(n_timein,'%H:%i') as ntimein,
DATE_FORMAT(n_timeout,'%H:%i')as ntimeout,
DATE_FORMAT(n_timein,'%Y-%m-%d') As n_date,
DATE_FORMAT(s_timein,'%Y-%m-%d') As s_date_timein,
DATE_FORMAT(s_timeout,'%Y-%m-%d') As s_date_out,
DATE_FORMAT(s_timein,'%H:%i') as stimein,
DATE_FORMAT(s_timeout,'%H:%i') as stimeout,detail
from time_sheet_table ,user_table
where user_table.user_id = time_sheet_table.user_id
and username = '$name' and password = '$pass'";
$nongA = mysql_query($sql);
while ($test =mysql_fetch_array($nongA)){
?>
<tr>
<td width="43" height="33" align="center" valign="middle"><? echo $test['id']?></td>
<td width="21" align="center" valign="middle"><? echo $test['user_id'];?></td>
<td width="21" align="center" valign="middle"><? echo $test['day']; ?></td>
<td><? echo $test['n_date'];?></td>
<td><? echo $test['ntimein'];?></td>
<td><? echo $test['ntimeout'];?></td>
<td><? echo $test['s_date_timein'];?></td>
<td width="128"><? echo $test['stimein'];?></td>
<td width="130" align="center" valign="middle"><? echo $test['s_date_out'];?></td>
<td width="111" align="center" valign="middle"><? echo $test['stimeout'];?></td>
<td width="139" align="center" valign="middle"><? echo $test['detail'];?></td>
<td width="139" align="center" valign="middle"><a href="edit1.php?id=<? echo $test['id']?>">Edit</a></td>
<td width="20" align="center"><a href="delete.php?id=<? echo $test['id']?>">Delete</a></td>
</tr>
<? } ?>
</table>
</center>
</body>
</html>
ลองดูใหม่ดิค่ะ
เพราะว่าดูแล้วไม่น่าจะมีไรผิดแล้วนะ
|
|
|
|
|
Date :
2011-04-20 11:57:00 |
By :
nongking1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เช็คค่า $name กับ $pass แล้ว มันก็ไไม่ได้ผิดอะไร น่ะครับ แต่ทำมัน มันถึงไม่ขึ้น อ่ะครับ ช่วยๆๆ ตอบทีครับ ผมๆๆ
|
|
|
|
|
Date :
2011-04-20 12:13:18 |
By :
macro |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
งงแทนเลยครับ
|
|
|
|
|
Date :
2011-04-20 15:01:02 |
By :
badkung04 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้ แล้วงับบบบบบบบบบบบบบบบบบบบบบบบบ ได้แบบ งงๆๆๆๆๆๆๆๆๆๆๆๆ
|
|
|
|
|
Date :
2011-04-20 15:08:14 |
By :
macro |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|