업로드 된 최근 이미지를 표시해야하지만 첫 번째 항목 만 표시되는 것이 가장 오래된 이미지입니다. 우리의 데이터베이스는 다음과 같이 내장되어 있습니다 :PHP 테이블에서 최신 연도 표시
jos_campaigns_children
campaign_id | child_id | code | 1921 | 1921 | GTM-0103-A00627 |
jos_campaigns_children_detail 소스에
detail_id | child_year | campaign_id | 5788 | 2013 | 1920 | 1921 | 2011 | 1921 | 3656 | 2012 | 1921 | 5789 | 2013 | 1921 | 1922 | 2011 | 1922 |
HTML 코드 :
<img src="/child_images/<?php echo $row_children_list[code]; ?>-<?php echo $row_children_list[child_year]; ?>-S-1.jpg"
현재 HTML 출력 :
<img src="/child_images/GTM-0103-A00627-2011-S-1.jpg"
원하는 출력 :
<img src="/child_images/GTM-0103-A00627-2013-S-1.jpg"
난 그냥 모르는 그래서 가장 최근 연도 표시되는지에 $row_children_list[child_year]
을 대체 할 수있는 구문.
$query_children_list = "SELECT * FROM `jos_campaigns_children` a, `jos_regions` b, jos_campaigns_children_detail c WHERE (a.published ='1' and a.old_sponsor_id = '' and a.region_id = b.id and a.paypal_profile_status = '0' and a.campaign_id = c.campaign_id)" . $age_query . "" .$gender_query . "" . $location_query . " GROUP BY a.child_id ORDER BY a.campaign_id DESC LIMIT " . $starting_row . ", " . $row_per_page . "";
$result_children_list = mysql_query($query_children_list);
귀하의 검색어는 어디입니까? –
어떻게'$ row_children_list []'를 만들 수 있습니까? – paqogomez
쿼리보기가없는'where child_year = max (child_year)'를 제안 할 수 있습니다. –