รบกวนช่วยดูโค้ดหน่อยครับ ผมเอาโค้ดอัพโหลดภาพไปใส่แล้วมันให้insert ไม่ได้ ถ้าไม่ใส่โค้ดอัพโหลดภาพมันinsert ได้ปกติครับ
รบกวนช่วยดูโค้ดหน่อยครับ ผมเอาโค้ดอัพโหลดภาพไปใส่แล้วมันให้insert ไม่ได้ ถ้าไม่ใส่โค้ดอัพโหลดภาพมันinsert ได้ปกติครับ ไม่แน่ใจว่าแทรกโค้ดผิดตำแหน่งหรือป่าว รบกวนหน่อยครับทุกท่าน
----
<?
session_start();
?>
<html>
<head>
<title></title>
<meta http-equiv="content-type" charset="utf-8" />
</head>
<body>
<?
$date = $_POST['date'];
$rdocom = $_POST['rdocom'];
$cause = $_POST['txta_cause'];
$demand = $_POST['txta_demand'];
$detail = $_POST['txta_detail'];
$offer = $_POST['lml_offer'];
$namelabel = $_POST['txtnamelabel'];
$num = $_POST['txtnum'];
$producerid = 1234;
$qty = $_POST["txtnum"];
echo $name = $_POST['txtName'];
?>
<?
mysql_connect("้host","1234","1234");
mysql_select_db("documentupload");
/*---------------------ส่วนของการอัพโหลดภาพ------------------------------------------------------------------------------------- */
$sur = strrchr($_FILES['filUpload']['name'],".");
$newfilename = (Date("dmy_His").$sur);
echo $newfilename;
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"myfile/".$newfilename))
{
echo "Copy/Upload Complete<br>";
/* --------------------------------------------------------------------------------------------------------------------- */
mysql_query("SET NAMES UTF8");
$strSQL = "
INSERT INTO oder_work (order_for,order_date_begin,order_date_finish,numdetail,order_name_labels,order_offer_id,order_cause,order_demand,order_detail,order_thumbnails,order_filesname,order_producer_id)
VALUES
('".$rdocom."','".date("Y-m-d H:i:s")."','".$date."' ,'".$qty."','".$namelabel."','".$offer."','".$cause."','".$demand."','".$detail."','".$name."','".$newfilename."','".$producerid."')
";
mysql_query($strSQL) or die(mysql_error());
$strOrderID = mysql_insert_id();
for($i=0;$i<=(int)$_SESSION["intLine"];$i++)
{
if($_SESSION["stritem_id"][$i] != "")
{
$strSQL = "
INSERT INTO order_work_detail(order_id,item_id)
VALUES
('".$strOrderID."','".$_SESSION["stritem_id"][$i]."')
";
mysql_query($strSQL) or die(mysql_error());
}
}
}
mysql_close();
session_destroy();
//header("location:finish_order.php?OrderID=".$strOrderID);
?>
<center><a href="full_view_fix.php?OrderID=<?=$strOrderID ?>" title="View">ดูงานที่สั่งทำ</a></center>
</body>
</html>Tag : PHP, MySQL
ประวัติการแก้ไข 2013-03-26 10:29:02
Date :
2013-03-26 10:27:58
By :
dagonov
View :
793
Reply :
7
อธิบาย ให้เครียหน่อยครับ อ่านแล้วงงจุงเบย
Date :
2013-03-26 10:36:41
By :
Ex-[S]i[L]e[N]t
คือผมเอาโค้ด อัพโหลดไปใส่ แล้วมันเพิ่มข้อมูลไม่ได้ครับ ตรง /*---------------------ส่วนของการอัพโหลดภาพ------------------------------------------------------------------------------------- */
คือโค้ดที่ผมเพิ่มไป
Date :
2013-03-26 10:44:47
By :
dagonov
ขอดูหน้าฟอร์มครับ
Date :
2013-03-26 10:47:36
By :
Ex-[S]i[L]e[N]t
โค้ดครับ
<?
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>
<meta http-equiv="content-language" content="en" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="R. Schoo" />
<link rel="stylesheet" media="screen" href="styles/vlaCal-v2.1.css" type="text/css" />
<link rel="stylesheet" media="screen" href="styles/vlaCal-v2.1-adobe_cs3.css" type="text/css" />
<link rel="stylesheet" media="screen" href="styles/vlaCal-v2.1-apple_widget.css" type="text/css" />
<script type="text/javascript" src="jslib/mootools-1.2-core-compressed.js"></script>
<script type="text/javascript" src="jslib/vlaCal-v2.1-compressed.js"></script>
<!-- You could also include the uncompressed versions for developing purposes:
<script type="text/javascript" src="jslib/mootools-1.2-core.js"></script>
<script type="text/javascript" src="jslib/vlaCal-v2.1.js"></script>-->
<title>ใบสั่งงาน</title>
<style>
body {
cursor: default;
text-align: left;
font-family: calibri, arial, sans-serif;
font-size: 13px;
margin: 0;
padding: 5px;
background-image: url(images/paper_1024.jpg);
}
table th {
vertical-align: top;
}
input {
text-align: center;
font-family: calibri, arial, sans-serif;
font-size: 13px;
background-color: white;
border: 1px solid;
border-color: #abadb3 #dbdfe6 #e3e9ef #e2e3ea;
padding: 2px;
}
input:focus, input:hover {
border-color: #5794bf #b7d5ea #c7e2f1 #c5daed;
}
.pickerImg {
position: absolute;
margin-left: -16px;
margin-top: 5px;
cursor: pointer;
}
.infoBox {
background-color: #fefdec;
border: 1px solid #edebcd;
padding: 6px;
margin-bottom: 20px;
}
</style>
<script type="text/javascript">
window.addEvent('domready', function() {
new vlaDatePicker('exampleI');
new vlaDatePicker('exampleII', { separator: '-', leadingZero: false, twoDigitYear: true, offset: { y: 3 }, alignX: 'center', alignY: 'bottom' });
new vlaDatePicker('exampleIII', { openWith: 'togglePicker', offset: { y: -2, x: 2 }, separateInput: { day: 'day', month: 'month', year: 'year' } });
new vlaDatePicker('exampleIV-A', { style: 'adobe_cs3', offset: { y: 1 }, format: 'm/d/y', ieTransitionColor: '' });
new vlaDatePicker('exampleIV-B', { style: 'apple_widget', offset: { x: 3, y: 1 } });
new vlaCalendar('exampleV', { startMonday: true });
new vlaDatePicker('exampleVI', { defaultView: 'year' });
new vlaDatePicker('exampleVII', { prefillDate: { day: 12, month: 12, year: 2012 } });
});
<!--//////////////เรียกหน้าต่างย่อย////////////////// -->
function fncDisplay(_check,i){
if(_check == true){
document.getElementById('txtName'+i).style.display='';
}
else{
document.getElementById('txtName'+i).style.display='none';
}
}
function fncOpenPopup()
{
window.open('item.php','popup-name','width=700,height=500,toolbar=0, menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');
}
<!--***********ฟังช์ชั่น ตรวจสอบค่าว่างradio button-********************** -->
function fncSubmit()
{
if(document.form1.rdo1.checked == false && document.form1.rdo2.checked == false && document.form1.rdo3.checked == false && document.form1.rdo4.checked == false && document.form1.rdo5.checked == false )
{
alert('กรุณาเลือกหัวข้อ ทำเพื่อบริษัท ');
return false;
}
document.form1.submit();
}
</script>
<!-- //////////////////////////////////////////////////////////////// -->
</head>
<body>
<?
mysql_connect("download.advanceseeds.com","wisanu","1234");
mysql_select_db("documentupload");
?>
<!--<div class="infoBox">
<b>This example page will only work on a webserver - AJAX requests are made to PHP files.</b><br />
For documentation and more examples visit <a href="http://dev.base86.com/scripts/vista-like_ajax_calendar_version_2.html">http://dev.base86.com/scripts/vista-like_ajax_calendar_version_2.html</a>.
</div> -->
<form action="save_checkout_fix.php" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();" enctype="multipart/form-data">
<table width="618" height="632" border="0" align="center" cellpadding="0" cellspacing="0" frame="border" >
<tr>
<td colspan="3"> </td>
<td width="123"><div align="left"><img src="images/1.png" width="122" height="30" /></div></td>
<td width="82"><div align="left"><input id="exampleI" name="date" type="text" style="width: 80px;" maxlength="10" /></div></td>
</tr>
<tr>
<td colspan="5"><center><img src="images/3.png" width="170" height="35" /></center></td>
</tr>
<tr>
<td width="140"><img src="images/4.png" width="140" height="25" /></td>
<td colspan="4"><input name="rdocom" type="radio" value="Advance" id="rdo1" >Advance
<input name="rdocom" type="radio" value="Star" id="rdo2" >Star
<input name="rdocom" type="radio" value="Flower" id="rdo3" >Flower
<input name="rdocom" type="radio" value="APAS" id="rdo4" >APAS
<input name="rdocom" type="radio" value="Promotion" id="rdo5" >Promotion
</td>
</tr>
<tr>
<td><img src="images/5.png" width="140" height="25" /></td>
<td colspan="4"><label for="select"></label>
<select name="lml_offer" >
<option>-กรุณาเลือก-</option>
</select></td>
</tr>
<tr>
<td><img src="images/6.png" width="140" height="25" /></td>
<td colspan="4" valign="top">
<p>
</p>
<p><input type="button" name="btnOpen" value="เพิ่มลักษณะงาน" OnClick="fncOpenPopup();" style="background:#CCC"></p></td>
</tr>
<tr>
<td><img src="images/num.png" width="65" height="25" /></td>
<td width="153"><input type ="text" name="txtnum" style="width: 150px;"/></td>
<td width="121"><img src="images/namelabel.png" width="121" height="34" />
</td>
<td colspan="2"><input type ="text" name = "txtnamelabel" /></td>
</tr>
<tr>
<td><img src="images/8.png" width="140" height="25" /></td>
<td colspan="4">
<textarea name="txta_cause" id="textarea" cols="73" rows="5" ></textarea></td>
</tr>
<tr>
<td><img src="images/9.png" width="140" height="25" /></td>
<td colspan="4"><textarea name="txta_demand" id="textarea" cols="73" rows="5" ></textarea></td>
</tr>
<tr>
<td><img src="images/10.png" width="140" height="25" /></td>
<td colspan="4"><textarea name="txta_detail" id="textarea" cols="73" rows="5" ></textarea></td>
</tr>
<tr>
<td><img src="images/name.png" width="65" height="25" /></td>
<td colspan="4"><table width="93" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="6"><br /></td>
</tr>
</table>
<input type="text" name="txtName"></td>
</tr>
<tr>
<td><img src="images/11.png" width="140" height="25" /></td>
<td><input type="file" name="filUpload" /></td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td colspan="2"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="65"><img src="images/13.png" width="65" height="25" /></td>
<td width="96"> </td>
<td width="17"><img src="images/14.png" width="55" height="25" /></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td colspan="2"><input name="" type="image" src="images/save-button-png-hi.png" width="150" height="55" /></td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
Date :
2013-03-26 10:54:37
By :
dagonov
Code (PHP)
mysql_connect("้host","1234","1234"); //เปลี่ยน connect ใหม่
mysql_connect("localhost","root","1234"); //example connect
ประวัติการแก้ไข 2013-03-26 11:03:19
Date :
2013-03-26 11:03:05
By :
Ex-[S]i[L]e[N]t
ตรงconnectไม่เกี่ยวครับผมใส่มาเองเพราะรันบนhostจริงครับ
Date :
2013-03-26 11:14:57
By :
dagonov
ลองเช็ค path ตรงรึเปล่า เปิด permission 777 ด้วยครับ
ประวัติการแก้ไข 2013-03-26 11:33:13
Date :
2013-03-26 11:32:46
By :
Ex-[S]i[L]e[N]t
Load balance : Server 01