Title: Using datafeeds with WordPress
Last modified: August 19, 2016

---

# Using datafeeds with WordPress

 *  [Phil Hancox](https://wordpress.org/support/users/pah/)
 * (@pah)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/using-datafeeds-with-wordpress/)
 * I am calling data from a separate database in my wordpress posts. In the single.
   php template, I want to make the process of calling this data automated by comparing
   the post number to a column I have called ‘postno’ and call the data that has
   the post number in that field.
    For example, if it is post number 3, it will 
   check which fields have the number 3 in column ‘postno’ and display the records.
 * This is the code, but I want to use `<?php the_id();?>` within it in the place
   of ‘THE POST NUMBER’:
 *     ```
       <?php
       mysql_connect("localhost", "user", "password") or die(mysql_error());
       mysql_select_db("database") or die(mysql_error());
   
       $result = mysql_query("SELECT * FROM database
        WHERE postno=' <strong>THE POST NUMBER</strong>' ) or die(mysql_error());
   
       while($row = mysql_fetch_array( $result )) {
       ```
   
 * Is there a way of doing this?

The topic ‘Using datafeeds with WordPress’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Phil Hancox](https://wordpress.org/support/users/pah/)
 * Last activity: [18 years, 4 months ago](https://wordpress.org/support/topic/using-datafeeds-with-wordpress/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
