หน้า 1 จากทั้งหมด 1

ช่วยดูโค้ดอัพโหลดนี้ให้ทีค่ะ

โพสต์แล้ว: 28 พ.ค. 2008, 15:40
โดย I3en_jung
มันเป็นโค้ดแก้ไขข่าวน่ะค่ะ รันผ่านทุกอย่าง แต่ว่าไม่อัพเดทลงไปในฐานข้อมูลให้ ติดต่อฐานข้อมูลถูกต้องค่ะ รบกวนด้วยนะค่ะ สำคัญมากๆ
<?
session_start();
if($_SESSION[sess_userid]<>session_id()){
header ("Location: pag_login.php"); exit();

}
$id_edit=$_POST['id_edit'];
$title=$_POST['title'];
$detail=$_POST['detail'];
$chkdel=$_POST['chkdel'];
$photo=$_FILES['photo']['tmp_name'];
$photo_name=$_FILES['photo']['name'];
$photo_size=$_FILES['photo']['size'];
$photo_type=$_FILES['photo']['type'];

//mysql_db_query($dbname,$sql) or die ("failed with error message: \"" . mysql_error () . '"');
include "connection.inc.php";

if($chkdel=="1"){
$sql="update tb_new set photo_new='' where id_new='$id_edit' ";
mysql_db_query($dbname,$sql);
@unlink($photo."/".$photo_del);
}
if($photo){
$ext=strtolower(end(explode('.',$photo_name)));
if($ext=="jpg"or $ext=="jpeg"or$ext=="gif"){
$filename=$id_edit.".".$ext;
copy($photo,"photo/".$filename);
$sql="update tb_new set photo_new='$filename' where id_new='$id_edit' ";
mysql_db_query($dbname,$sql);
}
}
$sql="update tb_new set title_new='$title',detail_new='$detail',type_new='$type' where id_new='$id_edit' ";
$result=mysql_db_query($dbname,$sql);
if($result){
echo "<h3>แก้ไขข่าวเรียบร้อยแล้วค่ะ</h3>";
echo"[<a href=new_main.php>กลับหน้าหลัก</a>]";
}
else {
echo "<h3>ไม่สามารถแก้ไขข้อมูลได้</h3>";
}
echo mysql_error();
mysql_close();
?>

โพสต์แล้ว: 28 พ.ค. 2008, 17:45
โดย mindphp
if($ext=="jpg"or $ext=="jpeg"or$ext=="gif"){
ลองแก้เป็น
if($ext=="jpg" or $ext=="jpeg" or $ext=="gif"){
หรือ
if($ext=="jpg" || $ext=="jpeg" || $ext=="gif"){

โพสต์แล้ว: 28 พ.ค. 2008, 20:22
โดย I3en_jung
ขอบคุณค่า