I am trying to get the value of meta_value field from current post.
<?php
$cupost = $post->ID;
$registros = $wpdb->get_results( 'SELECT meta_value FROM auto_postmeta
WHERE post_id = $cupost AND meta_key="mg_game"');
echo $registros[0]->meta_value . "<br/>";
?>
It does not shows the echo from $registros
.
But if i put directly on the query the number of the post (post_id = 7
), it shows the value of meta_value
.
Thy this out:
You have to concatenate the Query String with the Php Variables