|
|
|
สร้าง ไฟล์แก้ไขข้อมูลที่มีรูปด้วยโดยดึงข้อมูลมารูปมาการฐานข้อมูลsql ช่วยแก้ให้หน่อยครับ |
|
|
|
|
|
|
|
ส่วนที่ดึงค่ามาแก้ไข
<tr>
<th height="26" scope="row">
<div align="left">
<input name="hidAction" id="hidAction" type="hidden" value="edit">
รูปภาพ </div>
<th height="26" scope="row">
<div align="left">
<div align="left">
<input type="file" name="file" >
</div>
<div align="left"> </div>
</table>
<p align="center">
<input type="submit" name="Submit" value="แก้ไขข้อมูล">
</p>
ส่วนตัวsubmit8iy[
<?php
//??????????????????????????
$hostname = "localhost"; //?????????
$user = "root"; //??????????
$password = "1234"; //????????
$dbname = "student_ocn"; //?????????????
$tblname = "student_ocn"; //?????????
// ????????????????????
mysql_connect($hostname, $user, $password) or die("?????????????????????");
// ??????????????
mysql_select_db($dbname) or die("????????????????????");
// ?????? SQL ???????????????
if($hidAction == "edit") {
if($file != "") {
$type = getimagesize($file);
if($type[2] == 1) {
$pic = $date."_img.gif";
} else if($type[2] == 2) {
$pic = $date."_img.jpg";
}
copy($file, "pic/$pic");
chmod("pic/$pic", 0664);
}
$sql = "update $tblname set id_student=id_student, name='$name', nickname ='$nickname ',year='$year', surname='$surname', address='$address',address1='$address1',fac='$fac',major='$major',
kad ='$kad ',amout='$amout',fisrt_finish='$fisrt_finish'
,exsample ='$exsample',work_new='$work_new',use_ubu='$use_ubu',tansion='$tansion',day='$day',pic='$pic',
birthday='$birthday',age ='$age',phone='$phone ',cellphone='$cellphone' where id_student=$id_student";
}else{
$sql = "update $tblname set id_student=id_student, name='$name', nickname ='$nickname ',year='$year', surname='$surname', address='$address',address1='$address1',fac='$fac',major='$major',
kad ='$kad ',amout='$amout',fisrt_finish='$fisrt_finish'
,exsample ='$exsample',work_new='$work_new',use_ubu='$use_ubu',tansion='$tansion',day='$day',
birthday='$birthday',age ='$age',phone='$phone ',cellphone='$cellphone' where id_student=$id_student";
}
$dbquery = mysql_db_query($dbname, $sql);
echo "<Font Size=4><B>แก้ไขข้อมูลเรียบร้อยแล้ว</B>";
echo "<Br><A Href=\"show.php\"> กลับไปดูข้อมูลนักศึกษา</A>"; // ??????????? \ ???? " ???????????? error ????????
?><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Tag : - - - -
|
|
|
|
|
|
Date :
2009-04-08 14:44:12 |
By :
nuttawut49172185 |
View :
1021 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|