Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > พี่ๆคะ รบกวนดูโค๊ดให้หน่อยนะคะ อัพรูปลงฐานข้อมูลของ appsev ไม่ได้ค่ะ ติดมาหลายวันแล้ว



 

พี่ๆคะ รบกวนดูโค๊ดให้หน่อยนะคะ อัพรูปลงฐานข้อมูลของ appsev ไม่ได้ค่ะ ติดมาหลายวันแล้ว

 



Topic : 099326



โพสกระทู้ ( 61 )
บทความ ( 0 )



สถานะออฟไลน์




ลองให้เพื่อนที่เก่งๆไล่โค๊ดให้ดู เพื่อนก็ช่วยไม่ได้ค่ะ เลยรบกวนอีกทีนะคะ ติดตรงนี้ที่เดียวก็จะเสร็จแล้วค่ะ
คือมันอัพโหลดรูปลงฐานข้อมูลใน appserv ไม่ได้ค่ะ รบกวนดูโค๊ดให้หน่อยนะคะ

หน้าฟอร์มรับค่าไฟล์และข้อมูล (PHP)
<?  @ session_start();
?>
<!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>
<title>Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	background-color: #CCCCCC;
}
a:link {
	color: #FF9900;
	text-decoration: none;
}
a:visited {
	color: #FF6633;
	text-decoration: none;
}
a:hover {
	color: #FFCC66;
	text-decoration: none;
}
a:active {
	color: #FF9900;
	text-decoration: none;
}
.style1 {
	color: #FF0000;
	font-weight: bold;
}
.style2 {color: #660000}
-->
</style></head>
<body>
 <?
include( "../config.php");
$sql2 = "  	SELECT CategoryID
 	       ,CategoryName
	    FROM room_category";
		$result2 = mysql_query($sql2, $Connect) or die(mysql_error());
if($_GET["RoomID"] != "")
{

	$sql1 = "  	SELECT 	r.RoomID
					,r.RoomName
					,r.RoomPrice
					,rc.CategoryID
					,rc.CategoryName
					,r.RoomDescription
					,r.RoomPicture
			   FROM     room r
				INNER JOIN room_category rc
				ON 	r.CategoryID = rc.CategoryID
				WHERE RoomID = ".$_GET["RoomID"] ;


	$result1 = mysql_query($sql1, $Connect) or die(mysql_error());

	
	while($row1 = mysql_fetch_array($result1))
	{
		$RoomID =  $row1['RoomID'] ;
		$RoomName =  $row1['RoomName'] ;
		$RoomPrice =  $row1['RoomPrice'] ;
		$RoomDescription =  $row1['RoomDescription'] ;
		$RoomPicture =  $row1['RoomPicture'] ;
	
	}
}
else
{
	$id ="";
}
?>
<form id="addroom" enctype="multipart/form-data" name="addroom" method="post" action="addroom_save_action.php<? echo "?edit=$id"?>"> 
<table width="1000" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="4"><a href="Manage_Admin.php"><img src="../images/aaa.jpg" width="228" height="105" border="0" /></a> </td>
</tr>
<tr>
<td bgcolor="#666666">&nbsp;</td>
</tr>
<tr>
<td colspan="4" bgcolor="#FFFFFF"> <div align="center"><span class="AdminText style2" ><strong>เพิ่มรายการห้อง</strong></span></div>
<table width="929" border="0">
<tr>
<th width="75" scope="col">&nbsp;</th>
<th width="844" scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td align="left"><table width="783" border="0" align="center" cellpadding="0" cellspacing="1" class="AdminText">
<tr>
<td width="96">ชื่อห้อง  *</td>
<td width="660"> 
<div align="left">
           <input name="txtRoomName" type="text" id="txtRoomName" value="<?=$RoomName; ?>" size="50"/>
           <input name="hiddenRoomID" type="hidden" id="hiddenRoomID" value="<?=$RoomID; ?>" />
</div></td>
</tr>
<tr>
<td><div align="left">ราคา *</div></td>
<td>
<div align="left">
            <input name="txtRoomPrice" onKeyPress="return checkIt(event)" type="text" id="txtRoomPrice" value="<?=$RoomPrice?>" size="50"/>
</div></td></tr> <tr>
<td><div align="left">ประเภท</div></td>
<td> <div align="left"><select id="cboRoom_category" name="cboRoom_category">
             <option>--- เลือก ---</option>
			<?
			while($row2 = mysql_fetch_array($result2)){
			?>
			<option  value="<?=$row2['CategoryID'];?>" ><?=$row2['CategoryName'];?></option>
			<?
			}
			?>
                 </select>
</div></td></tr>
<tr>
<td><div align="left">รูป *</div></td>
<td><input name="fileUpload" type="file" value="<?=$PicEdit?>" id="Pic_path"  size="50"/>
               <?
                          if($_GET["edit"] != "")
				{
					echo "<img width=\"50\" src=\"$PicEdit\">";
				 }
		 ?>
                  <input type="hidden" name="Pic_path" value="<?=$PicEdit?>" id="Pic_path"  /></td>
</tr>
<tr>
<td align="">&nbsp;</td>
<td><span class="style1">**รูปต้องเป็นไฟล์ JPG, JPEG เท่านั้น </span></td>
</tr>
<tr>
<td align="">รายละเอียด</td>
<td>
 <div align="left">
<textarea name="txtDescription" cols="55" rows="5" id="txtDescription" ><?=$RoomDescription; ?></textarea>
</div></td>
</tr>
 <tr>
<td>&nbsp;</td>
<td><div align="left"></div></td>
</tr>
</table></td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td><div align="center">
                     <input type="submit" name="saveproduct" id="saveproduct" value="ตกลง" />
                     <input type="reset" name="cancleproduct" id="cancleproduct" value="ยกเลิก" onclick="parent.location.href='../admin/edit_room.php'" />
</div></td>
</tr>
<tr>
<th scope="row"><div align="center"></div></th>
<td><div align="center"><a href="../admin/edit_room.php"><img src="../images/Back.png" width="15" height="15" /> กลับไปหน้าแก้ไข</a></div></td>
</tr>
</tr>
  </table>
  <br />
  <br />
</form>
<?
mysql_close($Connect); //ปิดการติดต่อฐานข้อมูล
?>
</body>
</html>


อันนี้เป็นหน้าประมวลผลค่ะ
หน้าการประมวลผล (PHP)
<? session_start();
include( "../config.php");		
if($_POST["hiddenRoomID"] != "")
		{
			 $_POST["hiddenRoomID"]; 
			 $SQLUpdate = "  UPDATE room 
							SET    `RoomName` = '".$_POST["txtRoomName"]."'
									, `RoomPrice` = '".$_POST["txtRoomPrice"]."'
									, `CategoryID` = '".$_POST["cboRoom_category"]."'
									, `RoomDescription` = '".$_POST["txtDescription"]."'
							WHERE  RoomID = '".$_POST["hiddenRoomID"]."'";
			$Result1 = mysql_query($SQLUpdate);
			
			if( $_FILES["file"]["name"] != "" ){
				 $SQLUpdate = " UPDATE room 
								SET    `RoomPicture` = '".$_FILES["file"]["name"]."'
								WHERE  RoomID = '".$_POST["hiddenRoomID"]."'";
				move_uploaded_file($_FILES["file"]["tmp_name"],"../Imageroom/".$_FILES["file"]["name"]);
				$Result1 = mysql_query($SQLUpdate);
				
			}
		}
		else
		{
		 	   $insertSQL = "INSERT INTO room (
									 `RoomName`
									, `RoomPrice`
									, `CategoryID`
									, `RoomPicture`
									, `RoomDescription`
								)VALUES(
									'".$_POST["txtRoomName"]."'
									, '".$_POST["txtRoomPrice"]."'
									, '".$_POST["cboRoom_category"]."'
									, '".$_FILES["file"]["name"]."'
									, '".$_POST["txtDescription"]."'
								) ";
								
			move_uploaded_file($_FILES["file"]["tmp_name"],"../Imageroom/".$_FILES["file"]["name"]);
		 	$result1 = mysql_query($insertSQL, $Connect) or die(mysql_error());
		}
		echo"<meta http-equiv='refresh' content='0 ;URL = edit_room.php '>";
?>



รบกวนพี่ๆผู้รู้ด้วยนะคะ ขอบคุณมากๆค่ะ



Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2013-08-20 03:06:54 By : redkimono View : 648 Reply : 3
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Quote:
fileUpload


Code
move_uploaded_file($_FILES["file"]["tmp_name"]


ทำไมชื่อไม่เหมือนกันล่ะครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-20 06:02:45 By : mr.win
 


 

No. 2



โพสกระทู้ ( 61 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2013-08-20 06:02:45
รายละเอียดของการตอบ ::
เดี๋ยวหนู ลองเปลี่ยนดูค่ะพี่วิน ขอบคุณมากนะคะพี่

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-20 12:51:01 By : redkimono
 

 

No. 3



โพสกระทู้ ( 61 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2013-08-20 06:02:45
รายละเอียดของการตอบ ::
เย้ๆๆๆ ได้แล้วค่ะพี่ ขอบคุณมากนะคะพี่

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2013-08-20 12:55:29 By : redkimono
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : พี่ๆคะ รบกวนดูโค๊ดให้หน่อยนะคะ อัพรูปลงฐานข้อมูลของ appsev ไม่ได้ค่ะ ติดมาหลายวันแล้ว
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่