<?php
$down_arr=mysql_query("select * from (select post_id,
max(case meta_key when '_mddp_down_title' then IFNULL(meta_value,0) end) as m_title,
max(case meta_key when '_mddp_down_url' then IFNULL(meta_value,0) end) as m_url,
max(case meta_key when '_mddp_down_pwd' then IFNULL(meta_value,0) end) as m_passwd
from wp_postmeta where meta_key like '_mddp_down%'
group by post_id) w
where m_title !=''
and post_id='$id'");
$d_count=mysql_num_rows($down_arr);
$df_info=mysql_fetch_array($down_arr);
if ($d_count > 0 ) { ?>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a href=<?=$df_info['m_url']?>>点击下载:<?=$df_info['m_title']?></a>
</h3>
</div>
</div>
</div>
<?php } ?>