Jump to content

Newbie question


augment

Recommended Posts

Hi there, I am scratching my head for ages trying to get this to work.  I am adapting a script that simply outputs a floorplan image from a MySQL database. Only problem is that it outputs the <DIV> and all the title and formatting even if no image exists. I only want to output the <DIV> if an image exists.  Thanks in advance for any help. Charlotte

 

 

<div id="property-contact">
    <h2 id="h2-section" class="h2-section"><?php _e('Floor Plan',TS_DOMAIN) ?></h2>
    <div class="box2 clearfix">
   <?php $floor_plans_image_id =get_post_meta($post->ID, "_thumbnail_id", true);
   			$myrows = $wpdb->get_results( "SELECT guid FROM wp_posts WHERE ID=".$floor_plans_image_id );

   ?>
   <a href="<?=$myrows[0]->guid?>" rel="prettyPhoto[gallery]"><img src="<?=$myrows[0]->guid?>" width="250px;"/></a>
</div><!-- end box3 -->
</div>

Link to comment
https://forums.phpfreaks.com/topic/248917-newbie-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.