|
|
|
โค้ด Edit upload ช่วยดูหน่อยครับ บันทึกข้อมูลที่อัพโหลดไม่ได้ |
|
|
|
|
|
|
|
Code (PHP)
<?
ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:login.php');
exit();
}
//============ Start Session áÅзӡÒÃàÃÕ¡ Function µÔ´µèÍ°Ò¹¢éÍÁÙÅ
require_once('../connect/connect.php');
if($_GET["Action"]=="Save")
{
if($_FILES["Picture"]["name"] != "")
{
$name=$_FILES['Picture']['name'];
$tmp=$_FILES['Picture']["tmp_name"];
$date_time=date("Y-m-d H:i:s");
$oldname=explode(".",$name);
$ext = "";
$ext = ".".$oldname[count($oldname)-1];
$Picture_1 =date('YmdHis').$ext;
copy($tmp,"../picture/".$Picture_1);
}else{
$Picture_1 = "$_POST[Picturesend]";
}
//=========== บันทึกข้อมูลสินค้า
$sql_up = "update movie set MovieName='$_POST[MovieName]',MovieDes='$_POST[MovieDes]',RentPrice='$_POST[RentPrice]',RentDay='$_POST[RentDay]',MovieinShop='$_POST[MovieinShop]',FineperDay='$_POST[FineperDay]',Picture='$Picture_1' where MovieID='$_GET[MovieID]'";
mysql_query($sql_up);
echo"<script language='JavaScript'>";
echo"alert('แก้ไขข้อมูลเรียบร้อยแล้ว');";
echo"window.location='searchmagmovie.php';";
echo"</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #0FF;
}
-->
</style></head>
<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="4">
<tr>
<th height="200" colspan="2" scope="row">Admin Management</th>
</tr>
<tr>
<th width="220" scope="row" valign="top"><table width="220" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<th width="220" height="470" background="../img/kk.gif" scope="row"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="row"><img src="../img/bmenu.gif" alt="" width="200" height="50"></th>
</tr>
<tr>
<th scope="row"><img src="../img/brent.gif" alt="" width="200" height="50"></th>
</tr>
<tr>
<th scope="row"><img src="../img/brerent.gif" alt="" width="200" height="50"></th>
</tr>
<tr>
<th scope="row"><a href="cutreg.php"><img src="../img/breg.gif" alt="" width="200" height="50"></a></th>
</tr>
<tr>
<th scope="row"><img src="../img/bregm.gif" alt="" width="200" height="50"></th>
</tr>
<tr>
<th scope="row"><a href="addmovie.php"><img src="../img/baddmovie.gif" alt="" width="200" height="50"></a></th>
</tr>
<tr>
<th scope="row"><a href="#"><img src="../img/bmoviemag.gif" alt="" width="200" height="50"></a></th>
</tr>
<tr>
<th scope="row"><img src="../img/bnew.gif" alt="" width="200" height="50"></th>
</tr>
<tr>
<th scope="row"><a href="javascript:if(confirm('ออกจากระบบ')==true){window.location='login.php';}"><img src="../img/blogout.gif" alt="" width="200" height="50"></a></th>
</tr>
</table></th>
</tr>
</table></th>
<th width="768" scope="row"><table width="770" border="0" cellpadding="0" cellspacing="0" >
<tr>
<th height="470" align="center" scope="row" valign="top">
<table width="770" border="0" cellpadding="0" cellspacing="0" >
<tr>
<th height="470" align="center" bgcolor="#FFFFFF" scope="row">
<form action="<?=$_SERVER['PHP_SELF'];?>?MovieID=<?=$_GET["MovieID"];?>&Action=Save" name="frmEdit" method="post">
<?
$strSQL = "SELECT * FROM movie WHERE MovieID = '".$_GET["MovieID"]."' ";
$objQuery = mysql_query($strSQL);
$result = mysql_fetch_array($objQuery);
$Category_ID =$result['CategoryID'];
$Picture = $result['Picture'];
$vdo_m = $result['UrlMovie'];
if(!$result)
{
echo "Not found MovieID=".$_GET["MovieID"];
}
else
{
?>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="7">
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">รหัสภาพยนตร์ :</font></td>
<td colspan="3"><?=$result["MovieID"];?></td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">ประเภทภาพตร์ :</font></td>
<td colspan="3"><font size="2">
<?php
$sql2 = "select * From category";
$result2 = mysql_query($sql2);
$Num_Rows2 = mysql_num_rows($result2);
$result2 = mysql_query($sql2);
echo "<select name=CategoryID id=CategoryID class=input>";
echo "<option value=0>เลือกประเภทหนัง";
While($row2= mysql_fetch_array($result2)){
$CategoryID = $row2["CategoryID"];
$CategoryName = $row2["CategoryName"];
if ($Category_ID == "$CategoryID")
{
$sel = "selected";
}else{
$sel = "";
}
?>
<option value=<? echo "$CategoryID"; ?> <? echo "$sel"; ?>><? echo "$CategoryName"; ?>
<?
}
echo "</option></select>";
?>
</font></td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">ชื่อภาพยนตร์ :</font></td>
<td colspan="3"><label>
<input name="MovieName" type="text" id="MovieName" value="<?=$result["MovieName"];?>" size="50" />
</label></td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">รายละเอียด :</font></td>
<td colspan="3"><textarea name="MovieDes" cols="50" rows="5" id="MovieDes"><?=$result["MovieDes"];?></textarea></td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">ค่าเช่า/ชุด-เรื่อง :</font></td>
<td width="141"><input name="RentPrice" type="text" id="RentPrice" value="<?=$result["RentPrice"];?>" size="10" />
บาท.</td>
<td width="125"align="right" scope="row"><font size="3">จำนวนวันให้เช่า : </font></td>
<td width="309"align="left" scope="row"><input name="RentDay" type="text" id="RentDay" value="<?=$result["RentDay"];?>" size="10" />
วัน.</td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">จำนวนสินค้าทั้งหมด :</font></td>
<td width="141"><input name="MovieinShop" type="text" id="MovieinShop" value="<?=$result["MovieinShop"];?>" size="10" />
ชุด.</td>
<td align="right"><font size="3">ค่าปรับเมื่อคืนช้า :</font></td>
<td><input name="FineperDay" type="text" id="FineperDay" value="<?=$result["FineperDay"];?>" size="10" />
บาท</td>
</tr>
<tr>
<td width="140" align="right" valign="top" scope="row"><font size="3">รูปภาพ :</font></td>
<td colspan="3" align="left" scope="row">
<?
if ($Picture != "")
{
echo "<img src=../picture/$Picture width=150><br><a href=CancelPhotomovie.php?MovieID=$_GET[MovieID]&PhotoField=Picture&PhotoName=$Picture><font size=2 color=#ff0000>[ลบรูปภาพ]</font></a>";
echo "<input type=hidden name=Picturesend value='$Picture'>";
}else{
echo "<input type=file name=Picture size=50 class=input>";
}
?></td>
</tr>
<tr>
<td align="right" valign="top" scope="row"><font size="3" >ตัวอย่างภาพยนตร์ :</font></td>
<td colspan="3" align="left" scope="row">
<script src='AC_RunActiveContent.js' language='javascript'></script>
<!-- saved from url=(0013)about:internet -->
<script language='javascript'>
AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
'width', '550', 'height', '300', 'src',
((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'),
'pluginspage', 'http://www.macromedia.com/go/getflashplayer', 'id', 'flvPlayer', 'allowFullScreen', 'true', 'allowScriptAccess', 'always', 'movie',
((!DetectFlashVer(9, 0, 0) && DetectFlashVer(8, 0, 0)) ? 'OSplayer' : 'OSplayer'), 'FlashVars',
'movie=../vdo/<?=$result["UrlMovie"];?>&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=on');
</script>
<noscript>
<object width='550' height='300' id='flvPlayer'>
<param name='allowFullScreen' value='true'>
<param name="allowScriptAccess" value="always">
<param name='movie' value='OSplayer.swf?movie=../vdo/<?=$result["UrlMovie"];?>&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=on'>
<embed src='OSplayer.swf?movie=../vdo/<?=$result["UrlMovie"];?>&btncolor=0x333333&accentcolor=0x31b8e9&txtcolor=0xdddddd&volume=30&autoload=on&autoplay=off' width='550' height='300'
allowFullScreen='true' type='application/x-shockwave-flash' allowScriptAccess='always'>
</object>
</noscript><br>
<?
if ($vdo_m != "")
{
echo "<a href=Cancelvdo.php?MovieID=$_GET[MovieID]&vdoField=UrlMovie&vdoName=$vdo_m><font size=2 color=#ff0000>[ลบวีดีโอ]</font></a>";
echo "<input type=hidden name=vdosend value='$vdo_m'>";
}else{
echo "<input type=file name=vdo size=50 class=input>";
}
?></td>
</tr>
<tr>
<td colspan="4" align="right" scope="row"> </td>
</tr>
<tr>
<th colspan="4" align="center" scope="row"> <input type="submit" name="Save" id="Save" value="บันทึกข้อมูล" />
<input name="reset" type="reset" id="reset" value="เริ่มใหม่" /></th>
</tr>
</table>
<?
}
?>
</form></th>
</tr>
</table> </th>
</tr>
</table></th>
</tr>
<tr>
<th scope="row"> </th>
<th width="768" scope="row"> </th>
</tr>
</table>
</body>
</html>
ตามโค๊ดเลยครับ ช่วยดูทีครับว่าผิดตรงไหน
Tag : PHP, MySQL
|
ประวัติการแก้ไข 2011-07-25 06:05:34
|
|
|
|
|
Date :
2011-07-24 10:42:54 |
By :
donwaan2027 |
View :
883 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
thank you
|
|
|
|
|
Date :
2011-07-24 16:14:28 |
By :
nat182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|