|
 |
|
ช่วยดูโค้ดหน่อยค่ะรูปมันไม่แสดง select*from tb_photo order by id_photo desc limit $start,1 |
|
 |
|
|
 |
 |
|
$sql="select*from tb_photo order by id_photo desc limit
$start,1"; //คิวรี่ถูกมั้ยครับ หรือบางที * อาจจะชิดกันจนเกินไป
|
 |
 |
 |
 |
Date :
2009-05-05 13:14:04 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันก็ไม่ขึ้นอยู่ดีค่ะ
|
 |
 |
 |
 |
Date :
2009-05-05 13:36:13 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รันแล้ว มีอะไร Error มั้ยครับ ช่วยก๊อบมาให้ดูหน่อยครับ
|
 |
 |
 |
 |
Date :
2009-05-05 13:51:16 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่มีerrorเลยค่ะ
แต่ไม่ขึ้นรูปค่ะ
ขึ้นแค่นี้อ่ะค่ะ

|
 |
 |
 |
 |
Date :
2009-05-05 13:59:12 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ในฐานข้อมูลเก็บรูปอยู่รึป่าวครับ
ลองเปลี่ยน $start, 0 ดูมั้ยครับ
|
 |
 |
 |
 |
Date :
2009-05-05 14:08:54 |
By :
didoman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเปลี่ยนตรงนี้ดูน่ะครับ ได้รึป่าว
Code (PHP)
<?php
echo "<img src='../images/$name_photo' border=1><p>";
?>
|
 |
 |
 |
 |
Date :
2009-05-05 14:14:05 |
By :
didoman |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
$name_photo ในฐานข้อมูลคือชื่อภาพถูกต้องมั้ยครับ
แล้วได้เก็บนามสกุลด้วยหรือไม่?
|
 |
 |
 |
 |
Date :
2009-05-05 14:15:31 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันเก็บเป็นชื่อรูปอ่ะ
ต้องทำไงบ้างอ่ะงง
|
 |
 |
 |
 |
Date :
2009-05-05 14:22:34 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไมได้อ่ะแก้แล้วก็ไมได้
|
 |
 |
 |
 |
Date :
2009-05-05 14:26:59 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?php
echo $name_photo;
?>
ได้ค่าอะไร? ก๊อบมาให้ดูหน่อยครับ 
|
 |
 |
 |
 |
Date :
2009-05-05 14:34:49 |
By :
panyapol |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็เป็นชื่อรูปขึ้นมาค่ะอ่ะค่ะ
|
 |
 |
 |
 |
Date :
2009-05-05 14:39:12 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo "<img src='images/$name_photo' border=1><p>";
ถ้า echo $name_photo แล้วออกมาเป็นชื่อรูปที่ถูกต้อง ลองไปดูใน images ว่ามีรูปนั้นอยู่จริงหรือไม่ แล้ว script ที่รันอยู่ หมายถึง ไฟล์ php ที่รันอยู่ อยู่ในระดับเดียวกันกับ folder images หรือไม่
|
 |
 |
 |
 |
Date :
2009-05-05 15:26:53 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Warning: copy(images/1086.gif) [function.copy]: failed to open stream: No such file or directory in C:\AppServ\www\photo\insert.php on line 24
มันขึ้นerrorอย่างงี้อ่ะค่ะ
|
 |
 |
 |
 |
Date :
2009-05-05 15:30:10 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ถ้ารูปไม่ขึ้นแบบนี้มันจะเกี่ยวกับ พาสที่เก็บรูปไม่ถูกต้องหรือป่าวครับ
ลองทดสอบแบบนี้ดูครับว่ารูปมันจะมามั้ย
<img src='images/ตรงนี้ลองใส่ชื่อรูปที่มีอยู่.นาสกุลรูป' border=1><p>
ผมก็มั่วนิ่มเหมือนกัน ลองดูน่ะครับเผื่อจะช่วยอะไรได้บ้าง
|
 |
 |
 |
 |
Date :
2009-05-05 15:32:55 |
By :
namebom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?
$photo=$_FILES['photo']['tmp_name'];
$photo_name=$_FILES['photo']['name'];
$photo_size=$_FILES['photo']['size'];
$photo_type=$_FILES['photo']['type'];
$detail=$_POST['detail'];
if (!$photo){
echo "<h3>ERROR : ไม่สามารถ Upload รูปภาพได้</h3>";
}else{
include "connect.php";
$array_last=explode(".",$photo_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]) ;
if ($lastname == "gif" or $lastname == "jpg" or $lastname == "jpeg"){
($photo,"images/".$photo_name); errorบรรทัดนี้ค่ะ
$sql="insert into tb_photo values(' ','$photo_name' , '$detail')";
mysql_db_query($dbname,$sql);
echo"<a href='admin.php'>
<h3>Upload รูปภาพเรียบร้อยแล้ว</h3></a>";
}else{
echo "<h3>ERROR :เฉพาะรูปภาพนามสกุล *.gif, *.jpg, *.jpeg เท่านั้น</h3>";
}
unlink($photo);
mysql_close();
}
?>
|
 |
 |
 |
 |
Date :
2009-05-05 15:37:34 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<?
$photo=$_FILES['photo']['tmp_name'];
$photo_name=$_FILES['photo']['name'];
$photo_size=$_FILES['photo']['size'];
$photo_type=$_FILES['photo']['type'];
$detail=$_POST['detail'];
if (!$photo){
echo "<h3>ERROR : ไม่สามารถ Upload รูปภาพได้</h3>";
}else{
include "connect.php";
$array_last=explode(".",$photo_name);
$c=count($array_last)-1;
$lastname=strtolower($array_last[$c]) ;
if ($lastname == "gif" or $lastname == "jpg" or $lastname == "jpeg"){
copy ($photo,"images/".$photo_name); errorบรรทัดนี้ค่ะ
$sql="insert into tb_photo values(' ','$photo_name' , '$detail')";
mysql_db_query($dbname,$sql);
echo"<a href='admin.php'>
<h3>Upload รูปภาพเรียบร้อยแล้ว</h3></a>";
}else{
echo "<h3>ERROR :เฉพาะรูปภาพนามสกุล *.gif, *.jpg, *.jpeg เท่านั้น</h3>";
}
unlink($photo);
mysql_close();
}
?>
|
 |
 |
 |
 |
Date :
2009-05-05 15:39:43 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไฟล์นี้มันอยู่ระดับเดียวกับ images หรือเปล่าครับ ผมว่า path น่าจะผิดมันบอกประมาณว่า folder ที่จะ copy รูปไปไม่มีอยู่นะ หาไม่เจอ
|
 |
 |
 |
 |
Date :
2009-05-05 15:54:55 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ้าวตอนนี้ปัญหาคือ copy รูปไม่ได้เหลอครับ
|
 |
 |
 |
 |
Date :
2009-05-05 15:56:55 |
By :
namebom |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะ
เดียวจะลองแก้ไขดู
|
 |
 |
 |
 |
Date :
2009-05-05 16:07:25 |
By :
hui |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|