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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.