안녕하세요, 저는이 코드를 올바르게 작성하고 싶습니다. 구문에 대해서는 잘 모르겠습니다.PHP를 사용하여 테이블 데이터를 이미지와 일치 시키십시오.
여기 상황이 있습니다. 나는 디렉토리를 스캔하고 그 내용을 img 태그와 축소판으로 표시합니다. 또한 각 이미지를 테이블에 저장된 설명 및 제목과 일치 시키려고합니다.
디렉토리에있는 각 파일의 이름이 사용자 생성 값으로 작성되었으며, 동일한 테이블에 '이름'으로 저장되어 있습니다 ('ID', '이름', '제목', '설명'). 각 제목과 설명을 파일 이름과 일치시키고 img 태그와 링크의 적절한 위치에 배치하려고합니다. 나는 그것이 작동하는지조차 확실하지 않다 ... 그건 내 생각의 과정, 어쨌든
<?php
$connect = mysql_connect ("localhost","root","") or die("couldn't connect :(");
mysql_select_db("cynthieimages") or die("couln't find db :(");
*here I want to pull the data from the table into an $data[]
$handle = opendir(dirname(realpath(__FILE__)).'/images/fullscreen/graphicdesign/logos');
while($file = readdir($handle))
{
if($file !== '.' && $file !== '..')
{
*Right in here I need to define $title by exploding $file and geting the first part of the name*
*Here i want to define $description from $data[] where it shares a row name as $title*
echo '<a href="images/fullscreen/graphicdesign/logos/'.$file.'" rel="prettyPhoto[pp_gal]" title="'.$description.'"><img src="images/thumbnails/websitethumbs/graphicdesign/logos/th_'.$file.'" width="60" height="60" alt="'.$title.'" /></a>';
}
}
?>
: 여기
는 코드입니다. 제발, PHP의 주인, 내 원조에 와서)
나는 이해하지 못한다. 내가 파일에 저장 한 유일한 것은 이미지 다. 그것은 단지 이름 메타 데이터의 이름을 따서 명명됩니다. – Jeremythuff
$ result = mysql_query ('select ... from images where dir = "/ images/fullscreen/graphicdesign/logos ($ file = readdir ($ handle)) { " '); while (list (...) = mysql_fetch_row ($ result)) {...} –
gotcha, 고마워. – Jeremythuff