Title: PHP coding example to get data from database
Last modified: August 20, 2016

---

# PHP coding example to get data from database

 *  [bjarneh](https://wordpress.org/support/users/bjarneh/)
 * (@bjarneh)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/php-coding-example-to-get-data-from-database/)
 * Hell ao all!
    Can anyone give me an example of PHP coding to get data from my
   own table in the WordPress 3 database. I have an example in Joomla PHP:
 *     ```
       function getSats() {
       	$db = JFactory::getDBO();
       	$sql = "SELECT * FROM jos_alphajob_sats";
       	$db->setQuery($sql);
       	$data = $db->loadObjectList();
       	return($data);
       }
       ```
   
 * The above table are named “alphajob_sats” in the new WordPress database. There
   are 5 records (rows) with 2 fields (columns) named “sats_id” and “sats”.
 * I will be very pleased if anyone can help me over this hurdle!

Viewing 1 replies (of 1 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/php-coding-example-to-get-data-from-database/#post-2300693)
 * [http://codex.wordpress.org/Class_Reference/wpdb](http://codex.wordpress.org/Class_Reference/wpdb)

Viewing 1 replies (of 1 total)

The topic ‘PHP coding example to get data from database’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/php-coding-example-to-get-data-from-database/#post-2300693)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
