Title: Custom Table
Last modified: August 19, 2016

---

# Custom Table

 *  Resolved [da](https://wordpress.org/support/users/da/)
 * (@da)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/)
 * I’ve added a custom table but am having trouble returning records.
 * This line has been added to the header.php:
    <?php include(‘[http://127.0.0.1:8888/site-files/video-query.php&#8217](http://127.0.0.1:8888/site-files/video-query.php&#8217););?
   > This file contains the query and connection string.
 * The sidebar.php file contains this code:
    `<p class="BoldRed">Tips go Here...
   <?php echo $row_GetTip['Video_Category']; ?></p>` `<p class="BoldRed"><?php echo
   $row_GetInstructional['Video_Category']; ?> </p>` `<?php echo $row_GetInstructional['
   Video_Text']; ?>`
 * `<p>Instructions go here...<?php echo $row_GetInstructional['Video_Title']; ?
   ></p>`
    `<?php echo $row_GetTip['Video_Text']; ?>` `<p><?php echo $row_GetTip['
   Video_Title']; ?></p>`
 * The hard-coded text is being displayed, but none of the records are.
 * I’ve tested this on a custom template as well as the default template.
 * Ideas anyone??
 * david

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/#post-1290782)
 * If you put your custom table in your WordPress database, then you can use the
   [wpdb](http://codex.wordpress.org/wpdb) class to access and manipulate that data.
 *  Thread Starter [da](https://wordpress.org/support/users/da/)
 * (@da)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/#post-1290915)
 * Thanks.
 * Getting closer, but not quite there.
 * New code = `<h2><?php _e(‘Health Tips’,’mtsjourney’); ?></h2>
    - <?php $mydata = $wpdb->get_results($wpdb->prepare(“SELECT * FROM Video”));
      
      echo “
    -     ```
          "; print_r($mydata); echo "
          ```
      
    - “; ?> //just to see everything
 * `
 * As you can see from the screen shot url below, the video is being returned, however,
   the raw array code is also being printed.
 * The result can be viewed at [http://daviddoonan.com/Picture%203.png](http://daviddoonan.com/Picture%203.png)
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/#post-1290918)
 * Since $mydata is an object you need to access each ‘element’.
 * For example
 *     ```
       if ($mydata) {
       echo $mydata[0]->Video_Category;
       echo $mydata[0]->Video_Title;
       echo $mydata[0]->Video_Featured;
       echo $mydata[0]->Video_Text;
       }
       ```
   
 *  Thread Starter [da](https://wordpress.org/support/users/da/)
 * (@da)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/#post-1290920)
 * Thank you!!!!!!!!
 * david

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

The topic ‘Custom Table’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [da](https://wordpress.org/support/users/da/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/custom-table/#post-1290920)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
