|
|
|
อัปเดตแล้วไม่เข้าฐานข้อมูล ลองดูให้หน่อยนะครับ!!!! |
|
|
|
|
|
|
|
update แล้วไม่เข้าฐานข้อมูล แต่ไฟล์อื่น code เดียวกัน update ได้ แต่codeนี้ updateไม่ได้ครับ
Code (PHP)
<?
include("databaseuser.php");
include("make_clickable.php");
//error_reporting(E_ALL ^ E_NOTICE);
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><LINK rel="shortcut icon" href="/simborrow/image/lg2.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="refresh" content="1;URL=edit_com.php">
<title>Untitled Document</title>
</head>
<body>
<?
$conetion=mysql_connect($host,$user,$password) or die("ไม่สามารถติดต่อฐ้านข้อมูลได้");
$db=mysql_select_db($database) or die(mysql_error());
mysql_query("SET NAMES UTF8");
$strSQL = "UPDATE com SET ";
$strSQL .="brand = '".$_POST["brand"]."' ";
$strSQL .="model = '".$_POST["model"]."' ";
$strSQL .=",display = '".nl2br($_POST["display"])."' ";
$strSQL .=",hdd = '".nl2br($_POST["hdd"])."' ";
$strSQL .=",ram = '".nl2br($_POST["ram"])."' ";
$strSQL .=",cpu = '".nl2br($_POST["cpu"])."' ";
$strSQL .=",os = '".nl2br($_POST["os"])."' ";
$strSQL .=",ass_num = '".nl2br(nl2br($_POST["ass_num"]))."' ";
$strSQL .=",sr_num = '".nl2br($_POST["sr_num"])."' ";
$strSQL .=",equip = '".nl2br($_POST["equip"])."' ";
$strSQL .=",ser_tag = '".nl2br($_POST["ser_tag"])."' ";
$strSQL .=",emp_id = '".nl2br($_POST["emp_id"])."' ";
$strSQL .=",owner = '".nl2br($_POST["owner"])."' ";
$strSQL .="WHERE id = '".$_POST["id"]."' ";
$objQuery = mysql_query($strSQL);
$result = mysql_query("SELECT * FROM com WHERE ID = (SELECT MAX(ID) FROM com)");
$row = mysql_fetch_array($result);
for($i=0;$i<count($_FILES["hlsdUpload"]["name"]);$i++)
{
if($_FILES["hlsdUpload"]["name"][$i] != "")
{
if(move_uploaded_file($_FILES["hlsdUpload"]["tmp_name"][$i],"file/".$row["id"]."/hlsd/".iconv("UTF-8", "TIS-620",$_FILES["hlsdUpload"]["name"][$i])))
{
$result = mysql_query("SELECT * FROM com WHERE ID = (SELECT MAX(ID) FROM com)");
$row = mysql_fetch_array($result);
$strSQL = "UPDATE `com` SET `hlsd` = ";
$strSQL .="'".$row["hlsd"].$_FILES["hlsdUpload"]["name"][$i]."|' WHERE `id` = '".$row['id']."'";
$objQuery = mysql_query($strSQL);
}
}
}
for($i=0;$i<count($_FILES["scUpload"]["name"]);$i++)
{
if($_FILES["scUpload"]["name"][$i] != "")
{
if(move_uploaded_file($_FILES["scUpload"]["tmp_name"][$i],"file/".$row["id"]."/sc/".iconv("UTF-8", "TIS-620",$_FILES["scUpload"]["name"][$i])))
{
$result = mysql_query("SELECT * FROM com WHERE ID = (SELECT MAX(ID) FROM com)");
$row = mysql_fetch_array($result);
$strSQL = "UPDATE `com` SET `sc` = ";
$strSQL .="'".$row["sc"].$_FILES["scUpload"]["name"][$i]."|' WHERE `id` = '".$row['id']."'";
$objQuery = mysql_query($strSQL);
}
}
}
?>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-12-06 10:42:18 |
By :
haha |
View :
1023 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลอง echo $strSQL; เพื่อนำคำสั่งที่ใช้ไปลองทดสอบใน phpMyAdmin ในส่วนของ sql เพื่อดูว่าคำสั่งถูกต้องหรือไม่
|
|
|
|
|
Date :
2012-12-06 10:52:31 |
By :
wp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บรรทัดที่ 41 ลอง $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ดู error คับ
|
|
|
|
|
Date :
2012-12-06 11:14:56 |
By :
backship |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$strSQL .="model = '".$_POST["model"]."' "; ข้างหน้า model ลืม ลูกน้ำ หรือเปล่าครับ
|
|
|
|
|
Date :
2012-12-06 13:58:32 |
By :
kokiflam |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|