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 > การอัพโหลดรูปลง ฐานข้อมูล แล้วการดึงมาแสดง โดยมีรูปสินค้าเพิ่มเติม ทำยังไงครับ



 

การอัพโหลดรูปลง ฐานข้อมูล แล้วการดึงมาแสดง โดยมีรูปสินค้าเพิ่มเติม ทำยังไงครับ

 



Topic : 065697



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



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



หน้า การอัพรูป

หน้า

หน้า ที่แสดงสินค้า ซึ้นจะนำแค่รูปหลัก มาแสดง

หลัก

เมื่อคลิกรูปหลักเข้าไป

รวม

อยากให้รูปเพิ่มเติมแสดงเมื่อ ในรูปที่ ๅ เราได้ ทำการเพิ่มรูป เข้าไป และในเมื่อเราไม่ได้ใส่ก็จะไม่ให้มันแสดงเป็น กาบาก แบบนี้ และถ้าเราใส่รูปเพิ่มเติมไป 3 รูปก็ให้แสดงรูปเพิ่มอีกแค่ 3 รูป รูปที่ 4 5 ไม่ให้แสดงเลยต้องทำไงครับ


โค้ดตอนนี้ มั้วไปนิดนึงละ โคดของรูปที่ 1 ในช่วงบรรทักที่ 16 ได้เพิ่มโค้ดไป

Code (PHP)
<?
ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล 
require_once('../connect/connect.php');
require_once('../connect/function.php');

//=========== กรณีมีการแก้ไขรายการสินค้า
                       if($_GET["Action"]=="Save")
	                   {
					   $file_name = $HTTP_POST_FILES['file']['name'];
$file_name = $HTTP_POST_FILES['file01']['name'];
$file_name = $HTTP_POST_FILES['file02']['name'];
$file_name = $HTTP_POST_FILES['file03']['name'];
$file_name = $HTTP_POST_FILES['file04']['name'];
$file_name = $HTTP_POST_FILES['file05']['name'];
						   //===========  บันทึกข้อมูลสินค้า
	                  $sql = "update product set  Picture='$file_name',Picture01='$file01_name',Picture02='$file02_name', Picture03='$file03_name',Picture04='$file04_name',Picture05='$file05_name', ProductCode='$_POST[txtProductCode]',ProductName='$_POST[txtProductName]', Description='$_POST[txtDescription]',Price='$_POST[txtPrice]', PriceNormal='$_POST[txtPriceNormal]',PriceSend='$_POST[txtPriceSend]', Stock='$_POST[txtStock]',Promotion='$_POST[rdoPromotion]',New='$_POST[rdoNew]' where ProductID='$_GET[ProductID]'";
                      $dbquery = mysql_query($sql);
					  //echo $sql_up;
					//  exit();
					//===========  แก้ไขไฟล์เล็ก
					                   	if(!empty($dbquery_up))
                                             {
														$path="../picture";								
														//=========== อัพโหลตไฟลืเล็ก
                                                        copy($HTTP_POST_FILES['file']['tmp_name'],"$path/$file_name");
                                                       $sql = "update product set Picture='$file_name' where ProductID='$_GET[ProductID]'";
                                                       $dbquery = mysql_query($sql_update);
								 			 }
										 
					  
									echo"<script language='JavaScript'>";
									echo"alert('แก้ไขข้อมูลเรียบร้อยแล้ว');";
									echo"window.location='editproduct.php?ProductID=$_GET[ProductID]';";
									echo"</script>";					  
			 		  }
					  
?>
<html>
<title>..:: ระบบจัดการฐานข้อมูล ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<link rel="stylesheet" href="../css/styles.css" type="text/css">
<script language="JavaScript" src="editor.js"></script>
<div align="center"><br>
<?
//===========  อ่านว่าคือสินค้าชนิดใด
$result=select("product","where 1=1 and ProductID='".$_GET["ProductID"]."'");
if(!$result)
{
header("location:product.php");
}

?>
  <table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
    <tbody>
      <tr bgcolor=#e5e5e5> 
        <td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
          <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
            <tbody>
              <tr bgcolor=#e5e5e5> 
                <td width="35%" bgcolor="#FFFFFF"> <div align="left"><b><img src="../image/allrowto.gif" width="11" height="11" align="absbottom"> 
                    แก้ไขรายการสินค้า</b></div></td>
                <td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left"> 
                  </div></td>
                <td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="product.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td>
              </tr>
            </tbody>
          </table></td>
      </tr>
    </tbody>
  </table>
</div>

<form name="frm<?=$i;?>" method="post" action="<?=$_SERVER['PHP_SELF'];?>?ProductID=<?=$_GET["ProductID"];?>&Action=Save" enctype="multipart/form-data" onSubmit="return checkvalue()">
  <table cellspacing=1 cellpadding=3 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
    <tbody>
      <tr bgcolor=#e5e5e5> 
        <td width="31" bgcolor="#FFFFFF"> <script language="Javascript1.2"><!-- // load htmlarea
_editor_url = "";                     // URL to htmlarea files
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
  document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
  document.write(' language="Javascript1.2"></scr' + 'ipt>');  
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
// --></script> 
<script language="JavaScript">
function checkvalue()
{

		if(parseInt(document.all.txtPrice.value) >= parseInt(document.all.txtPriceNormal.value))
		{
		alert('ราคาพิเศษจะต้องน้อยกว่ากว่าราคาปกติ');
		document.all.txtPrice.focus();
		return false;
		}else
		{ return true; }

}
</script>
          <table width="100%" border="0" cellspacing="2" cellpadding="2">
            <tr> 
              <td width="18%">&nbsp;</td>
              <td width="82%">&nbsp;</td>
            </tr>
            <tr> 
              <td valign="top">รหัสสินค้า <font color="#FF0000">** </font></td>
              <td><input name="txtProductCode" type="text" class="txtbox" id="txtProductCode" value="<?=$result["ProductCode"];?>" maxlength="20" readonly="true"> 
              </td>
            </tr>
            <tr> 
              <td valign="top">สินค้าโปรโมชั่น <font color="#FF0000">** </font></td>
              <td><input name="rdoPromotion" type="radio" value="Yes" <? if($result["Promotion"]=="Yes"){?>checked<?}?>>
                ใช่ 
                <input type="radio" name="rdoPromotion" value="No" <? if($result["Promotion"]=="No"){?>checked<?}?>>
                ไม่ใช่</td>
            </tr>
            <tr> 
              <td valign="top">สินค้าใหม่ <font color="#FF0000">** </font></td>
              <td><input name="rdoNew" type="radio" value="Yes" <? if($result["New"]=="Yes"){?>checked<?}?>>
                ใช่ 
                <input type="radio" name="rdoNew" value="No" <? if($result["New"]=="No"){?>checked<?}?>>
                ไม่ใช่</td>
            </tr>
            <tr> 
              <td valign="top">ชื่อสินค้า <font color="#FF0000">** </font></td>
              <td><input name="txtProductName" type="text" class="txtbox" id="txtProductName" style="width:550" value="<?=$result["ProductName"];?>" maxlength="100"></td>
            </tr>
            <tr> 
              <td valign="top">ราคาปกติ <font color="#FF0000">** </font></td>
              <td><input name="txtPriceNormal" type="text" class="txtbox" id="txtPriceNormal" value="<?=$result["PriceNormal"];?>" size="10" maxlength="20">
                บาท </td>
            </tr>
            <tr> 
              <td valign="top">ราคาพิเศษ <font color="#FF0000">** </font></td>
              <td><input name="txtPrice" type="text" class="txtbox" id="txtPrice" value="<?=$result["Price"];?>" size="10" maxlength="20">
                บาท </td>
            </tr>
            <tr>
              <td valign="top">ค่าจัดส่ง</td>
              <td><input name="txtPriceSend" type="text" class="txtbox" id="txtPriceSend" value="<?=$result["PriceSend"];?>" size="10" maxlength="20">
                บาท </td>
            </tr>
            <tr> 
              <td valign="top">สำนวนสต็อก <font color="#FF0000">** </font></td>
              <td><input name="txtStock" type="text" class="txtbox" id="txtStock" value="<?=$result["Stock"];?>" size="10" maxlength="20"></td>
            </tr>
            <tr> 
              <td valign="top">รูปภาพ <font color="#FF0000">** </font></td>
              <td><img src="../picture/<?=$result["Picture"];?>" /></td>
            </tr>
            <tr> 
              <td valign="top">รูปหลัก</td>
              <td><input name="file" type="file" class="txtbox" id="file"></td>
            </tr>
			<tr> 
              <td valign="top">รูปเพิ่มเติม 1 </td>
              <td><input name="file" type="file" class="txtbox" id="file">
              ถ้ามี</td>
            </tr>
			<tr> 
              <td valign="top">รูปเพิ่มเติม 2 </td>
              <td><input name="file" type="file" class="txtbox" id="file">
              ถ้ามี</td>
            </tr>
			<tr> 
              <td valign="top">รูปเพิ่มเติม 3 </td>
              <td><input name="file" type="file" class="txtbox" id="file">
              ถ้ามี</td>
            </tr>
			<tr> 
              <td valign="top">รูปเพิ่มเติม 4 </td>
              <td><input name="file" type="file" class="txtbox" id="file">
              ถ้ามี</td>
            </tr>
			<tr> 
              <td valign="top">รูปเพิ่มเติม 5 </td>
              <td><input name="file" type="file" class="txtbox" id="file">
              ถ้ามี</td>
            </tr>
            <tr> 
              <td valign="top">รายละเอียด <font color="#FF0000">** </font></td>
              <td><textarea name="txtDescription" cols="40" rows="10" class="txtbox" id="txtDescription" style="width:550; height:450"><?=$result["Description"];?></textarea> 
                <script language="javascript1.2">
editor_generate('txtDescription');
</script> &nbsp;</td>
            </tr>
            <tr> 
              <td> </td>
              <td><input name="Submit" type="submit" class="button" value="บันทึก"> 
                <input name="Cancel" type="button" class="button" id="Cancel" value="ยกเลิก" onClick="window.location='product.php?CatID=<?=$result["CatID"];?>';"></td>
            </tr>
            <tr> 
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
            <tr> 
              <td>&nbsp;</td>
              <td>&nbsp;</td>
            </tr>
          </table></td>
      </tr>
  
    </tbody>
  </table>
  <table cellspacing=0 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10">
    <tbody>
      <tr bgcolor=#e5e5e5> 
        <td width="100%" bgcolor="#FFFFFF"> <div align="center"></div>
          <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10">
            <tbody>
              <tr bgcolor=#e5e5e5> 
                <td width="35%" bgcolor="#FFFFFF"> <div align="left"></div></td>
                <td width="22%" align=middle bgcolor="#FFFFFF"> <div align="left"> 
                  </div></td>
                <td width="43%" bgcolor="#FFFFFF"> <div align="right"><a href="product.php?CatID=<?=$result["CatID"];?>">กลับไป</a></div></td>
              </tr>
            </tbody>
          </table></td>
      </tr>
    </tbody>
  </table>
</form>



โค้ดของรูปที่ 3 ที่กำหนดให้มันแสดงรูปเพิ่มเติม แล้วไม่แสดงในกรณีที่ไม่ได้เพิ่มลงในรูปแรก
Code (PHP)
<?
ob_start();
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล 
session_start();
require("connect/connect.php");
require("connect/function.php");
?><head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>::: www.beautifulshop-dress.com :::</title>
<link href="css/styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: 16px;
	font-weight: bold;
}
-->
</style>
</head>

<style>body{background-attachment: fixed;}</style>
<body background="image/abc.jpg" topmargin="0">
<table width="1078" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
  <tr> 
    <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td>
            <?php require_once('head.php'); ?>
          </td>
        </tr>
        <tr> 
          <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#f2f2f6" bgcolor="#FFFFFF">
              <tr> 
                <td width="16%" valign="top"> <?php require_once('menuleft.php'); ?> <br> </td>
                <td width="100%" valign="top"> 
                  <table width="100%" border="0" cellpadding="0" cellspacing="0" >
                    <!--DWLayoutTable-->
                    <tr> 
                      <td width="100%" height="1541" valign="top"> 
                        <table width="100%" height="30" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
                          <tr> 
                            <td width="100%" background="image/menu02.jpg"><div align="center"><strong> 
							<? 
						
							  	//============   อ่านว่าเป็นหมวดหมุ่ใด
$resultHeadPro=select("category","where 1=1 and CatID='".$_GET["CatID"]."'");
if(!$resultHeadPro)
{
header("location:index.php");
}
echo "(".$resultHeadPro["CategoryName"].")";

							  	//============   อ่านว่าเป็นรายการสินค้าชนิดใด
$resultDetail=select("product","where 1=1 and ProductID='".$_GET["ProductID"]."'");
if(!$resultDetail)
{
header("location:index.php");
}
echo "  (".$resultDetail["ProductCode"]." - ".$resultDetail["ProductName"].")";


?>
   
                                </strong> </div></td>
                          </tr>
                        </table> 
                        <table width="100%" border="0">
                          <tr> 
                            <td>&nbsp;</td>
                            <td colspan="2">&nbsp;</td>
                          </tr>
                          <tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture"];?>" /></div></td>
                          </tr>
                          <tr> 
                            <td height="4" colspan="3"><hr width="96%" color="#f2f2f6">
                            </td>
                          </tr>
						  <tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture01"];?>" /></div></td>
                          </tr>
						  <tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture02"];?>" /></div></td>
                          </tr>
							<tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture03"];?>" /></div></td>
                          </tr>
							<tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture04"];?>" /></div></td>
                          </tr>
							<tr> 
                            <td height="34" colspan="3"><div align="center"><img src="picture/<?=$resultDetail["Picture05"];?>" /></div></td>
                          </tr>

						  <tr>
						  		<td width="43">
								</td>
								<td>
								</td>
							</tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td width="388" valign="top"><strong>รหัสสินค้า</strong> 
                              : 
                              <?=$resultDetail["ProductCode"];?>
                              <br>
                              <br>
                            <strong><img src="image/ed_image.gif" width="18" height="18" align="absmiddle"></strong><a href="send_contact.php?S=สอบถามสินค้า [<?=$resultDetail["ProductCode"];?> - <?=$resultDetail["ProductName"];?>]">สอบถามรายละเอียด</a></td>
                            <td width="287">ปกติ 
                              <?="(<s>".number_format($resultDetail["PriceNormal"], 2,'.',',')."</s>";?>
                              บาท)<strong> <br>
                              <font color="#FF0000">พิเศษ</font></strong> : 
                              <?="(".number_format($resultDetail["Price"], 2,'.',',');?>
                              บาท) <br>
                              ค่าจัดส่ง 
                              <?="(".number_format($resultDetail["PriceSend"], 2,'.',',');?>
                            บาท) </td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td><strong>ชื่อสินค้า</strong>&nbsp;&nbsp; : 
                              <?=$resultDetail["ProductName"];?></td>
                            <td><a href="cart.php?ProductID=<?=$resultDetail["ProductID"];?>"><img src="image/shopping.png" width="50" height="50" border="0" align="absmiddle"></a> 
                              <span class="style1"><font color="#FF0000">&lt;&lt;&lt;สั่งซื้อ</font></span></td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td colspan="2"><strong>รายละเอียด</strong>&nbsp;&nbsp; 
                              :</td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td colspan="2" bgcolor="#FFCCCC"> 
                              <?=$resultDetail["Description"];?>   
						    </td>
                          </tr>
                          <tr> 
                            <td>&nbsp;</td>
                            <td colspan="2">&nbsp;</td>
                          </tr>
                        </table>
                        <hr width="96%" color="#f2f2f6">
                      </p></td>
                    </tr>
                </table></td>
                <td width="16%" valign="top"> <?php require_once('menuright.php'); ?> </td>
              </tr>
              <tr> 
                <td colspan="3" valign="top">
                  <?php require_once('down.php'); ?>
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
  
</table>
</body>
</html>




Tag : PHP, CakePHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2011-08-31 20:02:35 By : tormam View : 4499 Reply : 19
 

 

No. 1



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



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

เพิ่มเติมครับจะทำคล้ายเว็บนี้อะครับ http://www.mayroses.com/products/view/96221






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 20:05:15 By : tormam
 


 

No. 2



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



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

ช่วยหน่อยครับพี่ๆๆๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 20:51:01 By : tormam
 

 

No. 3



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



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


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 21:50:20 By : tormam
 


 

No. 4



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

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

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


$file_name = $HTTP_POST_FILES['file']['name'];
$file_name = $HTTP_POST_FILES['file01']['name'];
$file_name = $HTTP_POST_FILES['file02']['name'];
$file_name = $HTTP_POST_FILES['file03']['name'];
$file_name = $HTTP_POST_FILES['file04']['name'];
$file_name = $HTTP_POST_FILES['file05']['name'];


<tr>
<td valign="top">รูปเพิ่มเติม 1 </td>
<td><input name="file" type="file" class="txtbox" id="file">
ถ้ามี</td>
</tr>
<tr>
<td valign="top">รูปเพิ่มเติม 2 </td>
<td><input name="file" type="file" class="txtbox" id="file">
ถ้ามี</td>
</tr>
<tr>
<td valign="top">รูปเพิ่มเติม 3 </td>
<td><input name="file" type="file" class="txtbox" id="file">
ถ้ามี</td>
</tr>
<tr>
<td valign="top">รูปเพิ่มเติม 4 </td>
<td><input name="file" type="file" class="txtbox" id="file">
ถ้ามี</td>
</tr>
<tr>
<td valign="top">รูปเพิ่มเติม 5 </td>
<td><input name="file" type="file" class="txtbox" id="file">
ถ้ามี</td>
</tr>
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 22:21:27 By : ikikkok
 


 

No. 5



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



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

ออ ลืมใส่ เลขไปครับ แต่ แก้แล้ว ก็ยัง ไม่ได้ เราต้องทำอย่างไรหรือครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 22:41:44 By : tormam
 


 

No. 6



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



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

เราสามารถทำให้ 5 รูป ที่เป็นรูปเพิ่มเติมไม่ แสดง เป็น กากบาท ได้ ไหมครับ เมื่อเราไม่ได้ ใส่ลงลงไป
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 22:45:27 By : tormam
 


 

No. 7



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

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

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


ใช้ if เช็ค empty เอาครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 22:53:49 By : ikikkok
 


 

No. 8



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



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

ใช้แบบ ที่พี่เคย โพสนี้ได้ปะครับ

https://www.thaicreate.com/php/php-multi-file-field-upload-mysql.html

โดยเอาไป แซก แล้วปรับ ผมว่ามันเพิ่มได้ แต่ถ้าจะดึงมามันดึงมาโชว์ได้ไหมอะครับ ต้องใช่ อาเร ดึงปะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 23:15:12 By : tormam
 


 

No. 9



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



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

พรุ่งนี้ผมจะลองดูอีกทีนะครับ วันนี้นอนก่อน พรุ้งนี้ต้องสอบครับพี่ ขอบคุณมากครับ ไว้จะมา ปรึกษาอีก
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-08-31 23:16:58 By : tormam
 


 

No. 10



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



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


^+^


ประวัติการแก้ไข
2011-09-01 18:47:12
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 01:18:45 By : Moo_mickey20
 


 

No. 11



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



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

อะนะ คุณก็ต้องลองทำด้วยนะครับ ไม่ใช่ว่ารออย่างเดียว นะ ช่วยกันคิด
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 12:03:02 By : tormam
 


 

No. 12



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



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


ก็เอาแบบนี้ก็ได้ครับ เก็บชื่อรูปไว้ในฐานข้อมูลแล้วเรียกชื่อรูปจากฐานข้อมูล โดย ใช้ part เข้ามาช่วยอะครับ
โดยในตอนเขียนPart ใช้วิธีนี้ครับ
1. เขียนดึงข้อมูลขึ้นมาปกติ
2. <?php echo"images/$pic"; ?>
ประมาณนี้ครับ ลองดูนะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 12:11:26 By : SOUL
 


 

No. 13



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



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

ยัง งงๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 15:07:37 By : tormam
 


 

No. 14



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



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

ช่วยดูโค้ด นี้ที่
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
<script language="javascript">
function fncCreateElement(){
var mySpan = document.getElementById('mySpan');
var myElement1 = document.createElement('input');
myElement1.setAttribute('type',"file");
myElement1.setAttribute('name',"filUpload[]");

//myElement1.setAttribute('id',"filUpload[]");

mySpan.appendChild(myElement1);   

//*** Remove Element ***//
/*
var deleteEle = document.getElementById('txt1');
mySpan.removeChild(deleteEle);
*/
var myElement2 = document.createElement('<br>');
mySpan.appendChild(myElement2);
}
</script>
</head>
<body>
<form name="frmMain" method="post" action="PageMultiUploadToMySQL2.php" enctype="multipart/form-data">
<input type="file" name="filUpload[]">
<input name="btnButton" id="btnButton" type="button" value="+" onClick="JavaScript:fncCreateElement();">
<br>
<span id="mySpan"></span>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>



โคดที่ 2 มันบอก
Warning: move_uploaded_file(myfile/D0033.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\000\PageMultiUploadToMySQL2.php on line 13

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php589.tmp' to 'myfile/D0033.jpg' in C:\AppServ\www\000\PageMultiUploadToMySQL2.php on line 13

Warning: move_uploaded_file(myfile/D0029.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\000\PageMultiUploadToMySQL2.php on line 13

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php59E.tmp' to 'myfile/D0029.jpg' in C:\AppServ\www\000\PageMultiUploadToMySQL2.php on line 13
Copy/Upload Complete

Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
for($i=0;$i<count($_FILES["filUpload"]["name"]);$i++)
{
if($_FILES["filUpload"]["name"][$i] != "")
{
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"][$i],"myfile/".$_FILES["filUpload"]["name"][$i]))
{
//*** Insert Record ***//
$strSQL = "INSERT INTO files ";
$strSQL .="(FilesName) VALUES ('".$_FILES["filUpload"]["name"][$i]."')";
$objQuery = mysql_query($strSQL);
}
}
}
echo "Copy/Upload Complete<br>";
?>
<a href="PageMultiUploadToMySQL3.php">View files</a>
</body>
</html>


ทำไรผิดไปไหมอะ งง อะครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 16:00:32 By : tormam
 


 

No. 15



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



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

บรรทัดที่ 13 ผิดอะไร หรอ หรือผมสร้างฐานข้อมูลผิด ฐานข้อมูลที่สร้างมาทดลอง

CREATE TABLE `files` (
`FilesID` int(4) NOT NULL auto_increment,
`FilesName` varchar(100) NOT NULL,
PRIMARY KEY (`FilesID`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 16:02:34 By : tormam
 


 

No. 16



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



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

งง
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 19:20:35 By : tormam
 


 

No. 17



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



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


ทำได้แล้วนะค่ะ อยากจะให้คุณ tor ว่าดิฉันทำได้แล้วค่ะ คุณก้อย่ารอให้คนอื่นมาตอบเหมือนกันละ คิดซะบ้างนะค่ะ อย่าดีแต่บอกคนอื่นแล้วตัวเองไม่ทำ โชคดีนะค่ะ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2011-09-01 21:30:32 By : Moo_mickey20
 


 

No. 18

Guest


Code (PHP)
$file01_name = $HTTP_POST_FILES['file01']['name']; 
$file02_name = $HTTP_POST_FILES['file02']['name']; 
$file03_name = $HTTP_POST_FILES['file03']['name']; 
$file04_name = $HTTP_POST_FILES['file04']['name']; 
$file05_name = $HTTP_POST_FILES['file05']['name']; 


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-02 22:17:45 By : เดาเอา
 


 

No. 19

Guest


Code (VB.NET)
sasasas

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-03 16:54:06 By : saasa
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : การอัพโหลดรูปลง ฐานข้อมูล แล้วการดึงมาแสดง โดยมีรูปสินค้าเพิ่มเติม ทำยังไงครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 04
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 อัตราราคา คลิกที่นี่