|
|
|
สอบถามปัญหา php ใส่ข้อมูลไปแล้ว ข้อมูลไม่ขึ้นอีก page |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>Thaimee </title>
</head>
<body>
<form name="form1" method="post" action="PageUploadToMySQL2.php" enctype="multipart/form-data">
Name : <input type="text" name="txtName"><br>
Filesname : <input type="file" name="filUpload"><br>
FilesID:<input type="text" name="txtName"><br>
Packing:<input type="text" name="txtName"><br>
Boxsize:<input type="text" name="txtName"><br>
Flavor:<input type="text" name="txtName"><br>
Catogary:<input type="text" name="txtName"><br>
Shelf Life:<input type="text" name="txtName"><br>
Barcode:<input type="text" name="txtName"><br>
Target:<input type="text" name="txtName"><br>
Best Seller:<input type="text" name="txtName"><br>
<input name="btnSubmit" type="submit" value="Submit">
</form>
</body>
</html>
Code (PHP)
<html>
<head>
<title>Thaimee </title>
</head>
<body>
<?
if($_FILES["filUpload"]["name"] != "")
{
//*** Read file BINARY ***'
$fp = fopen($_FILES["filUpload"]["tmp_name"],"r");
$ReadBinary = fread($fp,filesize($_FILES["filUpload"]["tmp_name"]));
fclose($fp);
$FileData = addslashes($ReadBinary);
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
$strSQL = "INSERT INTO files ";
$strSQL .="(FilesID,Name,FilesName,Packing,Boxsize,Flavor,Catogery,Shelf life,Barcode,Target,Best seller) VALUES ('".$_POST["txtName"]."','".$FileData."')";
$objQuery = mysql_query($strSQL);
echo "Copy/Upload Complete<br>";
}
?>
<a href="PageUploadToMySQL3.php">View files</a>
</body>
</html>
Code (PHP)
<html>
<head>
<title>Thaimee</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body>
<?
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
$strSQL = "SELECT * FROM files";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="340" border="1">
<tr>
<th width="50"> <div align="center">FilesID </div></th>
<th width="150"> <div align="center">FilesName</div></th>
<th width="150"> <div align="center">Name</div></th>
<th width="150"> <div align="center">Packing</div></th>
<th width="150"> <div align="center">Boxsize</div></th>
<th width="150"> <div align="center">Flavor</div></th>
<th width="150"> <div align="center">Categary</div></th>
<th width="150"> <div align="center">Shelf Life</div></th>
<th width="150"> <div align="center">Barcode</div></th>
<th width="150"> <div align="center">Target</div></th>
<th width="150"> <div align="center">Best Seller</div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["FilesID"];?></div></td>
<td><center><img src="myfile/<?php echo $objResult["FilesName"];?>"></center></td>
<td><center><?php echo $objResult["Name"];?></center></td>
<td><center><?php echo $objResult["Packing"];?></center></td>
<td><center><?php echo $objResult["Boxsize"];?></center></td>
<td><center><?php echo $objResult["Flavor"];?></center></td>
<td><center><?php echo $objResult["Categary"];?></center></td>
<td><center><?php echo $objResult["Shelf Life"];?></center></td>
<td><center><?php echo $objResult["Barcode"];?></center></td>
<td><center><?php echo $objResult["Target"];?></center></td>
<td><center><?php echo $objResult["Best Seller"];?></center></td>
</tr>
<?
}
?>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>
Code (PHP)
<?
$objConnect = mysql_connect("localhost","root","abcd1234") or die("Error Connect to Database");
$objDB = mysql_select_db("thaimee");
$strSQL = "SELECT * FROM files WHERE FilesID = '".$_GET["FilesID"]."' ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$objResult = mysql_fetch_array($objQuery);
echo $objResult["FilesName"];
?>
Tag : PHP, MySQL, HTML/CSS, JavaScript, CakePHP, Web (ASP.NET)
|
ประวัติการแก้ไข 2015-06-04 14:31:56 2015-06-04 14:39:28 2015-06-04 14:40:58
|
|
|
|
|
Date :
2015-06-04 14:29:45 |
By :
athiwatbuun |
View :
728 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขึ้นไม่ขึ้นมันน่าจะมี Error บ้างน่ะครับ เพราะถ้าเอาตัวอย่างมาจากในบทความมันกน่าจะได้ตามนั้นครับ
|
|
|
|
|
Date :
2015-06-04 16:27:54 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|