|
 |
|
แก้โค้ดให้หน่อยครับ...ดูให้หน่อยครับผมใช้ฟังชั่นทุกป่ะครับ |
|
 |
|
|
 |
 |
|
ดูให้หน่อยครับผมใช้ฟังชั่นทุกป่ะครับ
<?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 ???????????????
$dbquery = mysql_db_query($dbname, $sql);
echo "<Font Size=4><B>????????????????????????</B>";
echo "<Br><A Href=\"show.php\"> ??????????????????</A>"; // ??????????? \ ???? " ???????????? error ????????
$date = date("d");
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);
}
$host="localhost";
$db_username="root";
$db_password="1234";
$dbname="student_ocn";
$tblname = "student_ocn"; //?????????
$connect = mysql_connect($host,$db_username,$db_password);
if(!$connect){
echo "???????????????????????????"; exit();
$sql = "update $tblname set id_student=id_student, name='$name', nickname ='$nickname ',year='$year', surname='$surname', address='$address',address1='$address1',fac='$fac',major='$major',pic='$pic',
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";
}// ??????????? SQL ???????????????
}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"; // ??????????? SQL ???????????????
}
$dbquery = mysql_db_query($dbname, $sql);
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-04-09 15:23:04 |
By :
nuttawut49172185 |
View :
878 |
Reply :
7 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำไม connect 2 ทีละครับ ทีเดียวก็พอแล้วเอาบรรทัด connect ด้านล่างออกดีกว่า 
|
 |
 |
 |
 |
Date :
2009-04-09 15:35:19 |
By :
noomna19 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ฃอบคุณครับแต่ยังไม่ได้อยู่ดี
|
 |
 |
 |
 |
Date :
2009-04-09 15:47:20 |
By :
nuttawut49172185 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
บอกแค่ไม่ได้ นี่ก็มึนเลยซิครับ
ไม่ได้ยังไงก็บอกด้วย error ว่าอะไร
|
 |
 |
 |
 |
Date :
2009-04-09 15:54:47 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รู้สึกว่าวันนี้ คุณ PlaKriM จะมึนไปหลายตะหลบ เลยนะครับเนี้ย  
|
 |
 |
 |
 |
Date :
2009-04-09 16:00:20 |
By :
noomna19 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คือผมต้องการให้มันเช็คค่าน่ะครับ
ค่าpicน่ะครับ
คือถ้ามันไม่มีการเปลี่ยนแปลงรูปก็ไม่ต้อง update ข้อมูล ฟิวด์ pic ครับ
|
 |
 |
 |
 |
Date :
2009-04-09 16:01:40 |
By :
nuttawut49172185 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
$sql = "update $tblname set id_student=id_student, name='$name', nickname ='$nickname ',year='$year', surname='$surname', address='$address',address1='$address1',fac='$fac',major='$major'";
if($pic == "") $sql .= ", pic='$pic'"; // เช็คว่ามันว่างหรือเปล่า นี่เป็นตัวอย่างหากยังไม่ได้ เอา concept นี้ไปดัดแปลงดู
$sql .= ", 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";
?>
|
 |
 |
 |
 |
Date :
2009-04-09 16:10:18 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ได้อยู่ดีครับช่วยดูให้อีกที่หน่อยน่ะครับ
หรือแนะนำไฟล์ตัวอย่างก็ได้ครับ
จักเป็นพระคุณอย่างสูง
|
 |
 |
 |
 |
Date :
2009-04-09 16:29:10 |
By :
nuttawut49172185 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|