Title: Extracting datatable
Last modified: August 20, 2016

---

# Extracting datatable

 *  [michaelsrpersaud](https://wordpress.org/support/users/michaelsrpersaud/)
 * (@michaelsrpersaud)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/extracting-datatable/)
 * Hey Guys,
 * I ran a query against my database as follows:
 *  $table_name = $wpdb->prefix . “xyz”;
    $sql = “SELECT * FROM ” . $table_name ;
   $pageposts = $wpdb->get_results($sql, ARRAY_N); print_r($pageposts);
 * This works but when i’m trying to extract the data from the query i am stuck
 * Data looks like this (looks multidimensional to me)
    Array ( [0] => Array ( [
   0] => 123 [1] => 1 [2] => 1 [3] => 2 [4] => 0 [5] => 0 [6] => Whales [7] => 0[
   8] => 0000-00-00 ) )
 * What i would like to do is to be able to build an html table with an edit button
   at the side but if someone can guide me through being able to extract the data
   from the query e.g. field one “echo $pageposts ->id; or other i think i can figure
   the rest out.
 * Thanks in advance
 * Mike

The topic ‘Extracting datatable’ is closed to new replies.

## Tags

 * [arrays](https://wordpress.org/support/topic-tag/arrays/)
 * [database](https://wordpress.org/support/topic-tag/database/)
 * [queries](https://wordpress.org/support/topic-tag/queries/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [michaelsrpersaud](https://wordpress.org/support/users/michaelsrpersaud/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/extracting-datatable/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
