|
|
|
upload รูปเก็บใส่ folder ใน mysql แต่ url ที่เก็บไม่ตรงกับ code php ช่วยดูหน่อยครับ |
|
|
|
|
|
|
|
นั่งแก้มาเป็น ชั่วโมงแล้ว ครับ ยังเหลือ insert เข้าตารางที่ 2
Code (PHP)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<title>Untitled Document</title>
</head>
<?php
include("../include/config.inc.php");
$sql = sprintf("INSERT INTO book(book_name,book_author,book_isbn,book_call,book_link,book_detail,book_cover,book_lang) VALUES('%s' ,'%s' ,'%s' ,'%s' , '%s' , '%s','%s', '%s') ",
trim($_POST['book_name']),
trim($_POST['book_author']),
trim($_POST['book_isbn']),
trim($_POST['book_call']),
trim($_POST['book_link']),
trim($_POST['book_detail']),
trim($book_cover,"myfile/".$uploadfile_name),
trim($_POST['book_lang']));
mysql_query($sql) or die(mysql_error());
$customer_id = mysql_insert_id();
?>
<script>
alert('Insert Completed, Thanks');
window.location='index2.php';
</script>
<body>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2012-09-25 22:25:28 |
By :
relatedlove |
View :
1122 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บทความนี้ครับ
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?
if(move_uploaded_file($_FILES["filUpload"]["tmp_name"],"myfile/".$_FILES["filUpload"]["name"]))
{
echo "Copy/Upload Complete<br>";
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "INSERT INTO files ";
$strSQL .="(FilesName) VALUES ('".$_FILES["filUpload"]["name"]."')";
$objQuery = mysql_query($strSQL);
}
?>
<a href="PageUploadToMySQL3.php">View files</a>
</body>
</html>
Go to : PHP Uploads/Download Files To MySQL Database
|
|
|
|
|
Date :
2012-09-26 06:33:42 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|