ข้อมูลไม่ up ลงฐานข้อมูลให้ค่ะ ขึ้น Cannot Add Database ไม่ up ลงฐานข้อมูลให้ค่ะ
Code
<?php
@session_start();
ob_start();
$employee_usermem = $_SESSION["employee_usermem"];
require_once "includeData/connectdb.php";
require_once "includeData/connect.php";
require_once "includeData/tdate.php";
if($_FILES["employee_photo"]["name"] != "")
{
$name=$_FILES['employee_photo']['name'];
$tmp=$_FILES['employee_photo']["tmp_name"];
$date_time=date("Y-m-d H:i:s");
$oldname=explode(".",$name);
$ext = "";
$ext = ".".$oldname[count($oldname)-1];
$photo_1 =date('YmdHis').$ext;
copy($tmp,"IMG/".$photo_1);
}
$birthday = "$_POST[dd1] $_POST[mm1] $_POST[yy1]";
$passmem_md5 = md5($_POST[employee_passmem]);
mysql_query("INSERT INTO employees(id, employee_id,employee_fname,employee_name,employee_birthday,employee_address,employee_road,employee_district,employee_city,employee_province,employee_country,employee_zipcode,employee_phone,employee_fax,employee_mobile,employee_email,employee_photo,employee_usermem,employee_passmem,dateregist) values('', '$_POST[employee_id]','$_POST[employee_fname]','$_POST[employee_name]','$birthday','$_POST[employee_address]','$_POST[employee_road]','$_POST[employee_district]','$_POST[employee_city]','$_POST[employee_province]','$_POST[employee_country]','$_POST[employee_zipcode]','$_POST[employee_phone]','$_POST[employee_fax]',$_POST[employee_mobile]','$_POST[employee_email]','$photo_1','$_POST[employee_usermem]','$passmem_md5','$e_date $time')") or die ("Cannot Add Database");
?>
Tag : PHP, MySQL
Date :
2012-01-21 15:32:01
By :
MySeason22
View :
1201
Reply :
6
เยอะจัดเอา error มาดูครับ
Date :
2012-01-21 18:04:31
By :
Dragons_first
Code (PHP)
$sql = "INSERT INTO employees(id, employee_id,employee_fname,employee_name,employee_birthday,employee_address,employee_road,employee_district,employee_city,employee_province,employee_country,employee_zipcode,employee_phone,employee_fax,employee_mobile,employee_email,employee_photo,employee_usermem,employee_passmem,dateregist) values('', '$_POST[employee_id]','$_POST[employee_fname]','$_POST[employee_name]','$birthday','$_POST[employee_address]','$_POST[employee_road]','$_POST[employee_district]','$_POST[employee_city]','$_POST[employee_province]','$_POST[employee_country]','$_POST[employee_zipcode]','$_POST[employee_phone]','$_POST[employee_fax]',$_POST[employee_mobile]','$_POST[employee_email]','$photo_1','$_POST[employee_usermem]','$passmem_md5','$e_date $time')";
mysql_query($sql) or die (mysql_error() . '<br/>' . $sql);
แก้เป็นแบบนี้ แล้วเอา error มาดู
Date :
2012-01-21 18:18:11
By :
ikikkok
ได้แล้วค่ะ แต่รูปไม่ขึ้น ค่ะ รูปจะเข้าคำสัง else ตลอด nopic/nopic ในฐานข้อมูลค่ะ
Code
if($_FILES["employee_photo"]["name"] != "")
{
$name=$_FILES['employee_photo']['name'];
$tmp=$_FILES['employee_photo']["tmp_name"];
$date_time=date("Y-m-d H:i:s");
$oldname=explode(".",$name);
$ext = "";
$ext = ".".$oldname[count($oldname)-1];
$photo_1 =date('YmdHis').$ext;
copy($tmp,"IMG/".$photo_1);
}
else{
$photo_1="nopic/nopic";
}
mysql_query("INSERT INTO employees(id,employee_id,employee_fname,employee_name,employee_birthday,employee_address,employee_road,employee_district,employee_city,employee_province,employee_country,employee_zipcode,employee_phone,employee_fax,employee_mobile,employee_email,employee_photo,employee_usermem,employee_passmem,dateregist)values('','$_POST[employee_id]','$_POST[employee_fname]','$_POST[employee_name]','$birthday','$_POST[employee_address]','$_POST[employee_road]','$_POST[employee_district]','$_POST[employee_city]','$_POST[employee_province]','$_POST[employee_country]','$_POST[employee_zipcode]','$_POST[employee_phone]','$_POST[employee_fax]','$_POST[employee_mobile]','$_POST[employee_email]','$photo_1','$_POST[employee_usermem]','$passmem_md5','$e_date $time')") or die ("Cannot Add Database");
Date :
2012-01-21 21:41:35
By :
MySeason22
ก็แสดงว่า ไม่มี $_FILES["employee_photo"]["name"] ไงครับ เช็คดูชื่อดีๆ เช็คด้วยว่า from enctype หรือยัง
Date :
2012-01-21 21:45:20
By :
ikikkok
ตรวจสอบหมดแล้วน่ะค่ะ แต่ก็ยังเป็นเหมือนเดิมค่ะ ไม่มีส่วนไหน ให้แก้ด้วยค่ะ ชื่อ file ก็ตรงแล้วค่ะ ทั้งที่อยู่ใน form ด้วยค่ะ
ประวัติการแก้ไข 2012-01-21 23:42:15 2012-01-21 23:42:49
Date :
2012-01-21 23:40:49
By :
MySeason22
.......................
Date :
2012-01-22 19:49:33
By :
MySeason22
Load balance : Server 04