Title: image problem
Last modified: August 20, 2016

---

# image problem

 *  Resolved [cerberus478](https://wordpress.org/support/users/cerberus478/)
 * (@cerberus478)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/image-problem-21/)
 * Hi
 * I’m trying to get an image to show on a page, but I get a little box with a torn
   image.
 * This is the code I used
 *     ```
       <?php global $wpdb;
             $bras = $wpdb->get_results("SELECT * FROM bras;");
       ?>			
   
       <table>
          <?php foreach($bras as $bra): ?>
   
          <td><?php echo $bra->title ?><br />
          <img src="<?php echo $bra->filename; ?>" /><br />
          <?php echo $bra->content ?><br />
          <?php echo $bra->price ?><br />
   
       <?php endforeach; ?>
       </td>
       </table>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/image-problem-21/#post-3211534)
 * what is in your ‘bras’ database table?
 * what is the content of the `->filename`
 * imho, you would need to have an absolute image url in there to get it to show
   properly on all pages (index, archives, single,..)
 *  Thread Starter [cerberus478](https://wordpress.org/support/users/cerberus478/)
 * (@cerberus478)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/image-problem-21/#post-3211541)
 * Hi
 * Thanks for your reply, I found out what I need to do.
 * This is what I did, in case anyone else wants to know
 *     ```
       <?php global $wpdb;
               $bras = $wpdb->get_results("SELECT * FROM bras;");
       ?>			
   
       	<table>
       	<?php foreach($bras as $bra): ?>
   
       	<td><?php echo $bra->title ?><br />
       	<img src="<?php echo      bloginfo('template_directory').'/img/'.$bra->filename; ?>" /><br />
   
       <?php echo $bra->content ?><br />
       <?php echo $bra->price ?><br />
   
       <?php endforeach; ?>
       </td>
       </table>
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘image problem’ is closed to new replies.

## Tags

 * [image](https://wordpress.org/support/topic-tag/image/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [cerberus478](https://wordpress.org/support/users/cerberus478/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/image-problem-21/#post-3211541)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
