I have a pages setup that seems to work fine, but I want to get some professional feedback as I am a bit of a newb at the prepared statement usage. I have a PHP page that uses several fields from a MySQL database table in various places. Can I place the prepared statement at the top of my page, then use variables within page, and then close at bottom of page? Here is my example...

===================================
PHP Code:
<?php require_once('includes/db.php'); ?>
<?
    
if (isset($_GET['pageTitle'])) {
        
$pageTitle $_GET['pageTitle'];
    }
    else {
        
$pageTitle 'work';
    }
    
$result $db->prepare("SELECT `pageID`, `pageTitle`, `pageContent`, `metaTitle`, `metaDescription`, `metaKeywords` FROM `page` WHERE `pageTitle`=?");
    
$result->bind_param("s"$pageTitle);
    
$result->execute();
    
$result->bind_result($pageID$pageTitle$pageContent$metaTitle$metaDescription$metaKeywords);
    
$result->fetch();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $metaTitle?></title>
<meta name="description" content="<?php echo $metaDescription?>" />
<meta name="keywords" content="<?php echo $metaKeywords?>" />

</head>

<body>

<div id="col1">
     <?php echo $pageContent?>

     <?php if ('contact' == $pageTitle) { ?>
          <p>blah, blah, blah</p>
     <? ?>
</div>
</body>
</html>
<?php
    
// Free result set
    
$result->close();

    
// Close connection
    
$db->close();
?>
===================================

Any help is greatly appreciated.

Bryan