Getting data from postmeta table

WordPress Plugins and good code samples

April 2007

<?php  // the_meta();
global $wpdb;
// $thispostid = $post->ID;
$q = 'SELECT meta_value FROM '.$wpdb->postmeta.' WHERE post_id = '. $post->ID .' AND meta_key = 'Site URL' ' ;
$result = $wpdb->get_results("$q");
if (  $result[0]->meta_value != '') {
?>
<p><a href="<?php echo   $result[0]->meta_value; ?>">view site online</a>  </p>
<?php      }?>