내가 시도하고 데이터베이스에서 이미지를 검색하는 데 사용하고있는 코드 표시되지 : (확실하지 :가져 오는 이미지 이미지가
<?php
if($id)
{
//please change the server name username and password according to your mysql server setting
$mysql_server="localhost";
$mysql_username="myuser";
$mysql_password="mypass";
$mysql_database="mydb";
//connect to database using above settings
@MYSQL_CONNECT("localhost",$mysql_username,$mysql_password);
@mysql_select_db("mydb");
//select the picture using the id
$query = "select bin_data,filetype from todo where id=$id";
//execute the query
$result = @MYSQL_QUERY($query);
//get the picture data which will be binary
$data = @MYSQL_RESULT($result,0,"bin_data");
//get the picture type. It will change according to file extension it may be either gif or jpg
$type = @MYSQL_RESULT($result,0,"filetype");
//send the header of the picture we are going to send
Header("Content-type: $type");
//send the binary data
echo $data;
};
?>
대신의 요청 된 이미지를 표시,이 아이콘을 표시합니다 여기
http://i.imgur.com/bo6Jg.png 내 테이블의 모든 열이 무엇인지 당신이)를 호출 ... : http://i.imgur.com/PuWvl.png
내가 모든 일을하고있어 꽤 확실 해요 바로 ... 무슨 일이 일어나고 있는지 확실하지. 누구 한테 도움을 줘? 미리 감사드립니다!
그 사악한 @ 표지판을 제거하십시오! ?> –
mysql 함수 이름은 대소 문자를 구별합니다. 대/소문자는 대문자로 쓰일 수 있습니다. 오류를 숨기려면 크래커가 필요합니다. 또한 '$ id'도 비어 있습니다. 그래서 결코 멀리까지는 가지 않을 것입니다. 대신'isset ($ id) && is_numeric ($ id)'를 사용해야합니다. –
PHP에서 @LawrenceCherone 함수 이름은 대소 문자를 구분하지 않지만, 여전히 그들이 취급하는 것처럼 취급해야한다고 생각합니다. –