чет я никак не могу понять как подключить чтобы картинки отображались в списке найденных в поиске. может кто помочь правильно сформировать SQL запрос? файл search.
вот текущий запрос
if(@$_GET['images']=="1")$zzz="SELECT jb_board.id AS board_id, jb_board.id_category, jb_board.title, jb_board.price , DATE_FORMAT(jb_board.date_add,'%d.%m.%Y') AS dateAdd, jb_photo.photo_name ".@$other_city_column." FROM jb_board ".@$other_city_rightjoin." LEFT JOIN jb_photo ON jb_board.id = jb_photo.id_message WHERE jb_board.old_mess='old' ".$logic.$search_time.$search_city.$search_type.$search_cat.$search_price." GROUP by jb_board.id ORDER by board_id DESC LIMIT ".$start.", ".$lp;
else $zzz="SELECT jb_board.id AS board_id, jb_board.id_category, jb_board.title, jb_board.price, DATE_FORMAT(jb_board.date_add,'%d.%m.%Y') AS dateAdd ".@$other_city_column." FROM jb_board ".@$other_city_rightjoin." WHERE jb_board.old_mess='old' ".$logic.$search_time.$search_city.$search_type.$search_cat.$search_price." GROUP by jb_board.id ORDER by board_id DESC LIMIT ".$start.", ".$lp;
$last_add=mysql_query($zzz);cq();
$numr_last_add = mysql_num_rows($last_add);
if(@$numr_last_add){
и код для отображения
<div style="float:left" class="o4 alcenter"><? echo(@$last['photo_name'])?"<a href=\"c".$last['id_category']."-".$last['board_id'].".html\"><img class=\"thumb\" src=\"".$u."small/".$last['photo_name']."\" alt=\"".$last['title']."\" /></a>":"<img class=\"thumb\" src=\"".$im."nophoto.gif\" alt=\"nophoto\" />";?></div>
вот решение:
SQL
<? $photo=mysql_query("SELECT photo_name FROM jb_photo WHERE id_message='".$last['board_id']."'"); cq();
$list_photo=mysql_fetch_assoc($photo);
$isize=getimagesize($u."small/".$list_photo['photo_name']);?>
HTML
<div class="stradv"><div style="float:left" class="o4 alcenter"><? echo(@$list_photo['photo_name'])?"<a href=\"c".$last['id_category']."-".$last['board_id'].".html\"><img class=\"thumb\" src=\"".$u."small/".$list_photo['photo_name']."\" alt=\"".$last['title']."\" /></a>":"<img class=\"thumb\" src=\"".$im."nophoto.gif\" alt=\"nophoto\" />";?></div>
вот текущий запрос
if(@$_GET['images']=="1")$zzz="SELECT jb_board.id AS board_id, jb_board.id_category, jb_board.title, jb_board.price , DATE_FORMAT(jb_board.date_add,'%d.%m.%Y') AS dateAdd, jb_photo.photo_name ".@$other_city_column." FROM jb_board ".@$other_city_rightjoin." LEFT JOIN jb_photo ON jb_board.id = jb_photo.id_message WHERE jb_board.old_mess='old' ".$logic.$search_time.$search_city.$search_type.$search_cat.$search_price." GROUP by jb_board.id ORDER by board_id DESC LIMIT ".$start.", ".$lp;
else $zzz="SELECT jb_board.id AS board_id, jb_board.id_category, jb_board.title, jb_board.price, DATE_FORMAT(jb_board.date_add,'%d.%m.%Y') AS dateAdd ".@$other_city_column." FROM jb_board ".@$other_city_rightjoin." WHERE jb_board.old_mess='old' ".$logic.$search_time.$search_city.$search_type.$search_cat.$search_price." GROUP by jb_board.id ORDER by board_id DESC LIMIT ".$start.", ".$lp;
$last_add=mysql_query($zzz);cq();
$numr_last_add = mysql_num_rows($last_add);
if(@$numr_last_add){
и код для отображения
<div style="float:left" class="o4 alcenter"><? echo(@$last['photo_name'])?"<a href=\"c".$last['id_category']."-".$last['board_id'].".html\"><img class=\"thumb\" src=\"".$u."small/".$last['photo_name']."\" alt=\"".$last['title']."\" /></a>":"<img class=\"thumb\" src=\"".$im."nophoto.gif\" alt=\"nophoto\" />";?></div>
вот решение:
SQL
<? $photo=mysql_query("SELECT photo_name FROM jb_photo WHERE id_message='".$last['board_id']."'"); cq();
$list_photo=mysql_fetch_assoc($photo);
$isize=getimagesize($u."small/".$list_photo['photo_name']);?>
HTML
<div class="stradv"><div style="float:left" class="o4 alcenter"><? echo(@$list_photo['photo_name'])?"<a href=\"c".$last['id_category']."-".$last['board_id'].".html\"><img class=\"thumb\" src=\"".$u."small/".$list_photo['photo_name']."\" alt=\"".$last['title']."\" /></a>":"<img class=\"thumb\" src=\"".$im."nophoto.gif\" alt=\"nophoto\" />";?></div>
Последнее редактирование: