|
 |
|
รบกวนพี่ช่วยดูเรื่องปุ่มให้ทีครับถ้ายังไม่กดไม่ให้โชข้อมูล |
|
 |
|
|
 |
 |
|
Code (PHP)
if (isset($_POST['submit'])){
// true
}else{
// false
}
ลองแบบนี้ครับ
|
 |
 |
 |
 |
Date :
2013-03-01 10:11:16 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แบบนี้รึเปล่าครับ
มันไม่โชว์แล้วแต่พอกดปุ่มก็ไม่โชว์เหมือนเดิม
Code (PHP)
<?
if (isset($_POST['submit'])){
$room=$_GET['room'];
$strSQL = "SELECT * FROM classroom WHERE room LIKE '%".$room."%'";
$objQuery = mysql_query($strSQL);
$objResuut = mysql_fetch_array($objQuery);
}
else
{
echo "เลือกห้อง";
}
?>
|
 |
 |
 |
 |
Date :
2013-03-01 10:34:52 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอดูโค๊ดครับ
|
 |
 |
 |
 |
Date :
2013-03-01 10:42:11 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
session_start();
if($_SESSION['user'] == "")
{
echo "<META HTTP-EQUIV='Refresh'CONTENT=2,'index.php'>";
echo "<center><br><br>Please Login!</center>";
exit();
}
if($_SESSION['status'] != "USER")
{
echo "<META HTTP-EQUIV='Refresh'CONTENT=2,'index.php'>";
echo "This page for USER only!";
exit();
}
mysql_connect("localhost","root","1");
mysql_select_db("booking");
mysql_query("SET NAME utf8");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$strSQL = "SELECT * FROM member WHERE user = '".$_SESSION['user']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<!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>AdminPage</title>
<style type="text/css">
<!--
body {
background-image: url(pic/BG/bg3.jpg);
background-attachment:fixed;
background-position:center;
background-repeat: repeat;
}
#apDiv1 {
position:absolute;
left:634px;
top:311px;
width:363px;
height:179px;
z-index:1;
}
#apDiv2 {
position:absolute;
left:432px;
top:250px;
width:410px;
height:210px;
z-index:1;
}
#apDiv3 {
position:absolute;
left:567px;
top:504px;
width:76px;
height:31px;
z-index:1;
}
-->
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></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>
</head>
<body onload="MM_preloadImages('pic/button/หน้าแรก/2.png','pic/button/รายละเอียด/2.png','pic/button/วิธีใช้/2.png','pic/button/จองห้อง/2.png','pic/button/รายการจอง/2.png','pic/button/เกี่ยวกับเรา/2.png','pic/button/ติดต่อเรา/2.png','pic/button/ออกจากระบบ/2.png')">
<center>
<table width="1032" height="791" border="1">
<tr>
<td width="1022" colspan="5" bgcolor="#CCCCCC"><object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1035" height="181">
<param name="movie" value="SWF/header3.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="SWF/header3.swf" width="1035" height="181">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object></td>
</tr>
<tr>
<td height="537" colspan="5" bgcolor="#B1B1B1"><table width="1006" border="s">
<tr>
<td width="161" height="44"> <font size="+1">สถานะ :</font> <font size="+1">
<?=$objResult["status"];?>
</font></td>
<td width="835" rowspan="10" bgcolor="#FF6600"><table width="849" height="629" border="1">
<tr>
<td width="839" height="623" colspan="2" bgcolor="#999999"><table width="844" height="635" border="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="21"> </td>
<td width="255"> </td>
<td width="54"> </td>
<td width="81"> </td>
<td width="271"> </td>
<td width="4"> </td>
<td width="36"> </td>
<td width="8"> </td>
<td width="47"> </td>
<td width="25"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><form id="form1" name="form1" method="GET" action="?" />
<select name="room" >
<option value="" selected="selected"><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM classroom ORDER BY room ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["room"];?>">
<?=$objResuut["room"];?>
</option>
<?
}
?>
</select>
<label>
<input type="submit" name="Submit" id="button" value="Submit" />
</label></form></td>
<td> </td>
<td>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<?
if (isset($_POST['submit'])){
$room=$_GET['room'];
$strSQL = "SELECT * FROM classroom WHERE room LIKE '%".$room."%'";
$objQuery = mysql_query($strSQL);
$objResuut = mysql_fetch_array($objQuery);
}
else
{
echo "เลือกห้อง"
}
?> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="7" rowspan="4"><table width="444" height="332" border="0">
<tr>
<td width="110"> </td>
<td width="248"> </td>
<td width="64"> </td>
</tr>
<tr>
<td>เลขที่ห้อง</td>
<td><?
echo $objResuut["C_ID"];
?></td>
<td> </td>
</tr>
<tr>
<td>ชื่อห้อง</td>
<td><?
echo $objResuut["room"];
?></td>
<td> </td>
</tr>
<tr>
<td>อาคาร</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>จำนวนที่นั่ง</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>ประเภท</td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="295"> </td>
<td><img src="myfile/<? echo $objResuut["imgg"]?>"> </td>
<td> </td>
</tr>
<tr>
<td height="36"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="45"><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','pic/button/หน้าแรก/2.png',1)"><img src="pic/button/หน้าแรก/1.png" name="Image3" width="170" height="43" border="0" id="Image3" /></a></td>
</tr>
<tr>
<td height="45"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','pic/button/รายละเอียด/2.png',1)"><img src="pic/button/รายละเอียด/1.png" name="Image5" width="170" height="43" border="0" id="Image5" /></a></td>
</tr>
<tr>
<td height="45"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','pic/button/จองห้อง/2.png',1)"><img src="pic/button/จองห้อง/1.png" name="Image9" width="170" height="43" border="0" id="Image9" /></a></td>
</tr>
<tr>
<td height="45"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','pic/button/รายการจอง/2.png',1)"><img src="pic/button/รายการจอง/1.png" name="Image8" width="170" height="43" border="0" id="Image8" /></a></td>
</tr>
<tr>
<td height="45"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','pic/button/วิธีใช้/2.png',1)"><img src="pic/button/วิธีใช้/1.png" name="Image6" width="170" height="43" border="0" id="Image6" /></a></td>
</tr>
<tr>
<td height="45"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','pic/button/เกี่ยวกับเรา/2.png',1)"><img src="pic/button/เกี่ยวกับเรา/1.png" name="Image10" width="170" height="43" border="0" id="Image10" /></a></td>
</tr>
<tr>
<td height="21"><a href="mailto:[email protected]" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','pic/button/ติดต่อเรา/2.png',1)"><img src="pic/button/ติดต่อเรา/1.png" name="Image11" width="170" height="43" border="0" id="Image11" /></a></td>
</tr>
<tr>
<td height="21"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image12','','pic/button/ออกจากระบบ/2.png',1)"><img src="pic/button/ออกจากระบบ/1.png" name="Image12" width="170" height="43" border="0" id="Image12" /></a></td>
</tr>
<tr>
<td height="187"><object id="FlashID2" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="161" height="148">
<param name="movie" value="SWF/clock119.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="SWF/clock119.swf" width="161" height="148">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object></td>
</tr>
</table></td>
</tr>
<tr>
<td height="42" colspan="5" bgcolor="#CCCCCC"><img src="pic/BG/bg-abstract-blue.jpg" width="1035" height="55" /></td>
</tr>
</table>
</center>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
swfobject.registerObject("FlashID2");
//-->
</script>
<script language ="javascript">
function checkadd(){
if(document.room.txtroom.value == "")
{
alert("กรุณากรอกชื่อห้อง!!");
document.room.txtroom.focus();
}else
if(document.room.txtno.value.length == "" ){
alert("กรุณากรอกจำนวนที่นั่ง!!");
document.room.txtno.focus();
}
else
if(document.room.txtno.value >999){
alert("กรุณากรอกจำนวนที่นั่งให้ถูกต้อง !!!");
document.room.txtno.focus();
}else
if(document.room.txtno.value < 5){
alert("กรุณากรอกจำนวนที่นั่งให้ถูกต้อง !!!");
document.room.txtno.focus();
}else
if(document.room.txttype.value == "")
{
alert("กรุณากรอกประเภทห้อง!!");
document.room.txttype.focus();
}else
document.room.submit();
}
</script>
<script language ="javascript">
function checkout(){
if (confirm("คุณต้องการออกจากระบบหรือไม่"))
{
location = "logout.php";
}
}
</script>
</body>
</html>
|
 |
 |
 |
 |
Date :
2013-03-01 10:46:47 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โค๊ดนี้จากครั้งที่แล้วหรือเปล่าครับ
จุดประสงค์ของคุณคือ ไม่ให้ข้อมูล standby ใช่มั้ย 
|
 |
 |
 |
 |
Date :
2013-03-01 10:51:23 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่ายยยยไปถามอาจารย์มามะวานต้องใส่ ifเข้าไปครับ - - งงยังไงไม่รู้
|
 |
 |
 |
 |
Date :
2013-03-01 10:54:48 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พูดถึงนะครับ ส่วนมากก่อนการ search หรือการ select เค้าจะทำให้มีข้อมูล standby แต่ไม่เป็นไรครับ ถ้าต้องการเดี๋ยวจัดให้ครับ 
Code (PHP)
<tr>
<td> </td>
<td><form id="form1" name="form1" method="GET" action="?" />
<select name="room" >
<option value="" selected="selected"><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM classroom ORDER BY room ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="Act=Select&<?=$objResuut["room"];?>">
<?=$objResuut["room"];?>
</option>
<?
}
?>
</select>
<label>
<input type="submit" name="Submit" id="button" value="Submit" />
</label></form></td>
<td> </td>
<td>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<?
if ($_GET['Act']=="Select"){
$room=$_GET['room'];
$strSQL = "SELECT * FROM classroom WHERE room LIKE '%".$room."%'";
$objQuery = mysql_query($strSQL);
$objResuut = mysql_fetch_array($objQuery);
}
else
{
echo "เลือกห้อง"
}
?> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
|
 |
 |
 |
 |
Date :
2013-03-01 11:08:54 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เป็นเหมือนเดิมเลยครับ ตอนแรกก็ให้มันstandby แหละครับ แต่อาจารย์บอกเขาไม่อยากได้แบบนี้ Y_Y
|
 |
 |
 |
 |
Date :
2013-03-01 11:18:34 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
โทดครับ code ผิด ซักครู่ครับ
|
 |
 |
 |
 |
Date :
2013-03-01 11:30:01 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<tr>
<td> </td>
<td><form id="form1" name="form1" method="post" action="?Act=Select" />
<select name="room" >
<option value="" selected="selected"><-- Please Select Item --></option>
<?
$strSQL = "SELECT * FROM classroom ORDER BY room ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["room"];?>">
<?=$objResuut["room"];?>
</option>
<?
}
?>
</select>
<label>
<input type="submit" name="Submit" id="button" value="Submit" />
</label></form></td>
<td> </td>
<td>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<?
if ($_GET['Act']=="Select"){
$room=$_GET['room'];
$strSQL = "SELECT * FROM classroom WHERE room LIKE '%".$room."%'";
$objQuery = mysql_query($strSQL);
$objResuut = mysql_fetch_array($objQuery);
}
else
{
echo "เลือกห้อง"
}
?> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
|
 |
 |
 |
 |
Date :
2013-03-01 11:35:12 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วครับแต่มีปัญหาเกิดขึ้น คือ จะเลือก้หองอะไรมันก็จะโชวเป็นห้อง1ตลอดเลยครับ
|
 |
 |
 |
 |
Date :
2013-03-01 11:53:35 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<tr>
<td> </td>
<td><form id="form1" name="form1" method="post" action="?Act=Select" />
<select name="room" >
<option value="" selected="selected"><-- Please Select Item --></option>
<?
$Act=$_GET['Act'];
$room=$_POST['room'];
$strSQL = "SELECT * FROM classroom ORDER BY room ASC";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
if($room == $objResuut['room']){
$sel="selected";
}else{
$sel="";
}
?>
<option value="<?=$objResuut["room"];?>" <?=$sel;?>>
<?=$objResuut["room"];?>
</option>
<?
}
?>
</select>
<label>
<input type="submit" name="Submit" id="button" value="Submit" />
</label></form></td>
<td> </td>
<td>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<?
if ($Act == "Select"){
$room=$_POST['room'];
$strSQL = "SELECT * FROM classroom WHERE room LIKE '%".$room."%'";
$objQuery = mysql_query($strSQL);
$objResuut = mysql_fetch_array($objQuery);
}
else
{
echo "เลือกห้อง"
}
?> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
|
ประวัติการแก้ไข 2013-03-01 12:15:00
 |
 |
 |
 |
Date :
2013-03-01 11:58:19 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้กลายเป็นไม่มีอะไรขึ้นมาเลยอ่าครับ
(อยากเก่งโค้ดแบบพี่มั่งอะต้องทำไง )
|
 |
 |
 |
 |
Date :
2013-03-01 12:07:30 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ข้อมูลในlist box มันซ้ำกันอะครับต้องใส่อะไรเพิ่มหรอครับ
|
 |
 |
 |
 |
Date :
2013-03-01 12:28:15 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ๋อได้แล้วครับขอโทด ทีโค้ดมันซ้ำกัน ขอบคุณมากเลยครับ ถ้ามีติดอีกจะมารบกวนใหม่นะครับ
|
 |
 |
 |
 |
Date :
2013-03-01 12:30:09 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ครับรบกวนช่วยดูคำสั่งอัพเดต ให้ทีนะครับมันไม่ได้อะ
main
Code (PHP)
<form action="Updateroom.php?C_ID=<?=$objResult["C_ID"];?>" name="frmEdit" method="post">
<?
include ("config.php");
$strSQL = "SELECT * FROM classroom WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found C_ID=".$_GET["C_ID"];
}
else
{
?>
<table width="972" border="1">
<tr>
<th width="67">เลขที่ห้อง</th>
<th width="213"> <div align="center">ชื่อห้อง</div></th>
<th width="254"> <div align="center">สถานที่ตั้ง</div></th>
<th width="31">ที่นั่ง</th>
<th width="55"> <div align="center">ประเภท</div></th>
<th width="49"><div align="center">รูปเก่า </th>
<th width="257"> <div align="center">รูปใหม่ </div></th>
</tr>
<tr>
<td><div align="center"><input name="txtID" type="text" id="txtID" value="<?=$objResult["C_ID"];?>" size="5"></div></td>
<td><input type="text" name="txtName" size="20" value="<?=$objResult["room"];?>"></td>
<td><input name="txtEb" type="text" id="txtEb" value="<?=$objResult["build"];?>" size="20"></td>
<td><div align="center">
<input name="txtno" type="text" id="txtno" value="<?=$objResult["C_No"];?>" size="2">
</div></td>
<td align="right"><input name="txtt" type="text" id="txtt" value="<?=$objResult["C_type"];?>" size="5"></td>
<td align="right">
<input type="hidden" name="hdnOldFile" value="<?=$objResult["imgg"];?>">
</td>
<td align="right"><label>
<input type="file" name="filUpload" id="filUpload">
</label></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<?
}
?>
</form>
update
Code (PHP)
<?
include ("config.php");
$strSQL = "UPDATE classroom SET ";
$strSQL .="C_ID = '".$_POST["txtID"]."' ";
$strSQL .=",room = '".$_POST["txtName"]."' ";
$strSQL .=",build = '".$_POST["txtEb"]."' ";
$strSQL .=",C_no = '".$_POST["txtno"]."' ";
$strSQL .=",C_type = '".$_POST["txtt"]."' ";
$strSQL .="WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
if($_FILES["txti"]["name"] != "")
{
if(copy($_FILES["txti"]["tmp_name"],"myfile/".$_FILES["txti"]["name"]))
{
//*** Delete Old File ***//
@unlink("myfile/".$_POST["hdnOldFile"]);
//*** Update New File ***//
$strSQL = "UPDATE classroom ";
$strSQL .=" SET imgg = '".$_FILES["txti"]["name"]."' WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
}
?>
|
 |
 |
 |
 |
Date :
2013-03-01 16:23:32 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
include ("config.php");
$strSQL = "SELECT * FROM classroom WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found C_ID=".$_GET["C_ID"];
}
else
{
?>
<form action="Updateroom.php?C_ID=<?=$objResult["C_ID"];?>" name="frmEdit" method="post" enctype="multipart/form-data"> // ในการอัพไฟล์ ต้องมี enctype
<table width="972" border="1">
<tr>
<th width="67">เลขที่ห้อง</th>
<th width="213"> <div align="center">ชื่อห้อง</div></th>
<th width="254"> <div align="center">สถานที่ตั้ง</div></th>
<th width="31">ที่นั่ง</th>
<th width="55"> <div align="center">ประเภท</div></th>
<th width="49"><div align="center">รูปเก่า </th>
<th width="257"> <div align="center">รูปใหม่ </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" value="<?=$objResult["C_ID"];?>" size="5" disable></div></td>
<td><input type="text" name="txtName" size="20" value="<?=$objResult["room"];?>"></td>
<td><input name="txtEb" type="text" id="txtEb" value="<?=$objResult["build"];?>" size="20"></td>
<td><div align="center">
<input name="txtno" type="text" id="txtno" value="<?=$objResult["C_No"];?>" size="2">
</div></td>
<td align="right"><input name="txtt" type="text" id="txtt" value="<?=$objResult["C_type"];?>" size="5"></td>
<td align="right">
<input type="hidden" name="hdnOldFile" value="<?=$objResult["imgg"];?>">
</td>
<td align="right"><label>
<input type="file" name="filUpload" id="filUpload">
</label></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<?
}
?>
</form>
Code (PHP)
<?
include ("config.php");
$strSQL = "UPDATE classroom SET ";
// $strSQL .="C_ID = '".$_POST["txtID"]."' "; ตัดบรรทัดนี้ออกเนื่องจากเป็น ID อาจจะมีข้อผิดพลาดได้ ถ้าทำการเปลี่ยน ID อย่างหนึ่งถ้าเป็น primary key จะขึ้น error ทันที
$strSQL .=",room = '".$_POST["txtName"]."' ";
$strSQL .=",build = '".$_POST["txtEb"]."' ";
$strSQL .=",C_no = '".$_POST["txtno"]."' ";
$strSQL .=",C_type = '".$_POST["txtt"]."' ";
$strSQL .="WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
if($_FILES["txti"]["name"] != "")
{
if(copy($_FILES["txti"]["tmp_name"],"myfile/".$_FILES["txti"]["name"]))
{
//*** Delete Old File ***//
@unlink("myfile/".$_POST["hdnOldFile"]);
//*** Update New File ***//
$strSQL = "UPDATE classroom ";
$strSQL .=" SET imgg = '".$_FILES["txti"]["name"]."' WHERE C_ID = '".$_GET["C_ID"]."' ";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
}
|
 |
 |
 |
 |
Date :
2013-03-01 16:32:01 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
กลับมาแล้วครับ พึ่งถึงแล้วลองเอาดค้ตไปรัน มันอัพเดทรูปครับแต่ไม่อัพเดท ข้อมูล เลย
|
 |
 |
 |
 |
Date :
2013-03-01 18:41:18 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
บรรทัดที่ 5 เปลี่ยนใหม่
Code (PHP)
$strSQL .="room = '".$_POST["txtName"]."' ";
|
 |
 |
 |
 |
Date :
2013-03-01 18:49:36 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วครับ ขอบคุณมากๆ พี่ชื่อไรอะครับ 
|
 |
 |
 |
 |
Date :
2013-03-01 18:53:41 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ครับผมดึงข้อมูลมาจากฐานข้อมูลมาโชว์เป็น label แต่อยากให้มันโชว์อีกแบบต้องเขียนยังไงหรอครับเช่นในฐานข้อมูลเป็น1อยากให้มันโชวเป็นประเภทห้องเรียน ถ้า2ให้เป็นห้องคอมครับ
|
 |
 |
 |
 |
Date :
2013-03-01 18:57:44 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แนวทางครับ สมมุติเราส่งค่า C_ID=1 select จาก tb ได้ตามปกติเลยครับ
Code (PHP)
$C_ID=1;
$select=mysql_query("SELECT * FROM classroom WHERE C_ID='".$C_ID."'") or die (mysql_error());
|
 |
 |
 |
 |
Date :
2013-03-01 19:00:56 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ่อครับ เผื่ออาจารย์ถามใครเป็นคน support ให้
|
 |
 |
 |
 |
Date :
2013-03-01 19:01:11 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ผมไปทำแบบนี้อะครับมันขึ้นมาเป็นห้องเรียนหมดเลย- -
ทำแบบที่พี่แนะนำคือมันขึ้นมาแต่ห้องที่ WHERE อะครับ
Code (PHP)
<?
if($_POST['C_type'] == "1")
{
echo "ห้องคอม";
}
else
{
echo "ห้องเรียน";
}
$objResult["C_type"];
?>
|
ประวัติการแก้ไข 2013-03-01 19:44:08
 |
 |
 |
 |
Date :
2013-03-01 19:42:38 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
help me !!!!!
|
 |
 |
 |
 |
Date :
2013-03-02 09:45:48 |
By :
white31969 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|