Pages

how to get the single value in wordpress database.?

Monday, 30 September 2013

using get_var

example:

$table_name = $wpdb->prefix . "posts";

$post_content = $wpdb->get_var($wpdb->prepare( "SELECT post_content FROM $table_name WHERE post_status = %s",'publish'));

echo $post_content;
 

Most Reading