 |
ช่วยดูโค้ด Upload รูปภาพให้หน่อยค่ะ โค้ดทั้งหมดในการ Insert ค่ะข้อมูลอื่นลงหมดแล้วแต่รูปภาพไม่ยอมลงค่ะ ฟิลด์รูปภาพอยู่ในตาราง Member ค่ะ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
session_start();
include("../Connections/conn.php");
mysql_select_db($dbname);
//$signup = date("j/n/").(date("Y")+543);
$id_stu=$_POST[id_stu];
$name=$_POST[name];
$lastname=$_POST[lastname];
$date=$_POST[d];
$month=$_POST[m];
$yearday=$_POST[y];
$sql="select id_stu from student where id_stu='$id_stu'";
$result=mysql_query($sql);
$numrow=mysql_num_rows($result);
if($numrow==0){
echo"<h2><center><font color=blue>คุณไม่ใช่ศิษย์เก่าค่ะ แต่ถ้าคุณเป็นศิษย์เก่าจริงๆๆ<br> และต้องการใช้งาน กรุณาติดต่อกับ ผู้ดูแลระบบค่ะ</font></center></h2>";
echo"<hr>";
echo"<meta http-equiv='refresh' content='4; url=../index.php'>";
exit();
}
include("user.php");
copy($_FILES[photo][tmp_name],'photo/'.$_FILES[photo][name]);
$image=$_FILES[photo][name];
$sql="select * from member order by id desc";
$sql1="select * from user order by id desc";
$result=mysql_query($sql);
$result=mysql_query($sql1);
$dbarr = mysql_fetch_row($result);
$result=mysql_query("insert into member(id,id_stu,id_card,name,lastname,d,m,y,age,sex,address,district,pro,zip,tel,image,course,id_branch,attend,graduate,status_work,username) values ('','$id_stu','$txtID','$name','$lastname','$d','$m','$yearday','$age','$sex','$address','$district','$pro','$zip','$tel','$image','$c','$id_branch','$attend','$graduate','$r1','$user_name')") or die ("ERROR member");
$result=mysql_query("insert into user(id,username,password,status,email) values ('','$user_name','$pwd_name1','member','$email')") or die ("ERROR user");
if ($r1== "ทำงาน"){
$result=mysql_query("insert into workplace (id,id_stu,workplace,location,add1,dis,prov,zip,tel,salary) values ('','$id_stu','$workplace','$location','$add1','$pp','$prov1','$z1','$tell','$salary')") or die ("Err 1");
}else if ($r1== "ศึกษาต่อ"){
$result=mysql_query("insert into education (id,id_stu,education,course,branch) values ('','$id_stu','$edu','$course','$branch')") or die ("Err 2");
}else if ($r1== "ทำงานและศึกษาต่อ"){
$result=mysql_query("insert into learnwork (id,id_stu,work1,location1,add3,provin,z,tele,salar,educ,bra) values ('','$id_stu','$work1','$lo','$as','$provin','$zip11','$tel11','$sal','$ed','$br')") or die ("Err 3");
}
if($result){
$login_true=$user_name;
session_register("login_true");
echo"<h2><center>ขอบคุณสำหรับการลงทะเบียน<br>กรุณารอสักครู่เพื่อเข้าสู่ระบบ</center><h2>";
echo"<hr>";
echo"<meta http-equiv='refresh' content='3; url=../index.php'>";
}
?>
โค้ดทั้งหมดในการinsertค่ะข้อมูลอื่นลงหมดแล้วแต่รูปภาพไม่ยอมลงค่ะ ฟิลด์รูปภาพอยู่ในตารางmemberค่ะ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2010-02-17 23:31:53 |
By :
axiom |
View :
1013 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเปลี่ยน single quot เป็น double quot ' photo' เปลี่ยนเป็น "photo"
|
 |
 |
 |
 |
Date :
2010-02-18 11:20:46 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองแก้ตามนี้นะ
copy($_FILES["photo"]["tmp_name"],"photo/".$_FILES["photo"]["name"]);
|
 |
 |
 |
 |
Date :
2010-02-18 11:23:12 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แล้วไหนคำสั่ง insert photo ครับ หาไม่เจอ
|
 |
 |
 |
 |
Date :
2010-02-18 11:25:20 |
By :
Dragons_first |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$result=mysql_query("insert into member(id,id_stu,id_card,name,lastname,d,m,y,age,sex,address,district,pro,zip,tel,image,course,id_branch,attend,graduate,status_work,username) values ('','$id_stu','$txtID','$name','$lastname','$d','$m','$yearday','$age','$sex','$address','$district','$pro','$zip','$tel','$image','$c','$id_branch','$attend','$graduate','$r1','$user_name')") or die ("ERROR member");
โค้ดinsertรูปค่ะ ฟิลด์รูปimage ค่ะ
|
 |
 |
 |
 |
Date :
2010-02-18 13:42:08 |
By :
axiom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2010-02-18 14:45:43 |
By :
axiom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|