Integration issue – can’t read table value
-
Related to my earlier post about getting recent posts into the frontpage while WP is installed in a subfolder, I am trying to get a custom field accessed through the code (an image filename) to no avail. Can someone tell me what is wrong with this?
$news=$wpdb->get_results(“SELECT ‘ID’,’post_title’,’post_content’ FROM $wpdb->posts WHERE ‘post_type’=\”post\” AND ‘post_status’=\”publish\” ORDER BY post_date DESC LIMIT 3″);
foreach($news as $np){
$image=$wpdb->get_results(“SELECT ‘meta_value’ FROM $wpdb->postmeta WHERE ‘post_id’=$np->ID AND meta_key=\”featured_home_img\””);echo “Image is [$image->meta_value]”;
}$image->meta_value always comes back with an empty result. I checked the SQL query in phpMyAdmin and it executed just fine (with the value for “featured_home_img” returned). I checked the postmeta table and the relevant posts all have a meta_key called “featured_home_img”, so no problem there.
Please help me solve this. I am going bonkers again.
The topic ‘Integration issue – can’t read table value’ is closed to new replies.