3 deleted 5 characters in body; edited tags
source | link

imI'm trying to retrieve information on my wordpress database, i. I wanted to display all pages using this statement., but imI'm getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

outputOutput:

  ARRAY

[EDIT] afterEDIT: After changing below suggestions, imI'm now using this. but iI still dontdon't get any results.:

global $wpdb;

    $posts = $wpdb->wp_posts;
    $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );

    foreach ($result as $page) {
            echo $page->ID.'<br/>';

    }

im trying to retrieve information on my wordpress database, i wanted to display all pages using this statement. but im getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

output:

  ARRAY

[EDIT] after changing below suggestions, im now using this. but i still dont get any results.

global $wpdb;

    $posts = $wpdb->wp_posts;
    $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );

    foreach ($result as $page) {
            echo $page->ID.'<br/>';

    }

I'm trying to retrieve information on my database. I wanted to display all pages using this statement, but I'm getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

Output:

  ARRAY

EDIT: After changing below suggestions, I'm now using this. but I still don't get any results:

global $wpdb;

    $posts = $wpdb->wp_posts;
    $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );

    foreach ($result as $page) {
            echo $page->ID.'<br/>';

    }
    Tweeted twitter.com/#!/StackWordPress/status/497642957605195776
2 added 339 characters in body
source | link

im trying to retrieve information on my wordpress database, i wanted to display all pages using this statement. but im getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

output:

  ARRAY

[EDIT] after changing below suggestions, im now using this. but i still dont get any results.

global $wpdb;

    $posts = $wpdb->wp_posts;
    $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );

    foreach ($result as $page) {
            echo $page->ID.'<br/>';

    }

im trying to retrieve information on my wordpress database, i wanted to display all pages using this statement. but im getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

output:

  ARRAY

im trying to retrieve information on my wordpress database, i wanted to display all pages using this statement. but im getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

output:

  ARRAY

[EDIT] after changing below suggestions, im now using this. but i still dont get any results.

global $wpdb;

    $posts = $wpdb->wp_posts;
    $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );

    foreach ($result as $page) {
            echo $page->ID.'<br/>';

    }
1
source | link

get_results using wpdb

im trying to retrieve information on my wordpress database, i wanted to display all pages using this statement. but im getting a blank ARRAY

global $wpdb;
$result = $wpdb->get_results (
        "
        SELECT * 
        FROM  $wpdb->wp_posts 
        WHERE post_type =  'page'
        "
        );

echo $result; // display data

output:

  ARRAY