include() a file so every function has access
<p>if I do this</p>

<pre><code>include('orderConst_pdo_connect.php');
switch  ($type){
    case "retrieve":
        retrieve_address($customer_id);
        break;
    case "new":
        new_address($customer_id, $address);
        break;
    case "update":
        update_address($customer_id, $address_id);
        break;
    case "delete":
        delete_address($customer_id, $address_id);
        break;              
}

function retrieve_address($customer_id){
    $sth = $dbh-&gt;prepare("
    SELECT * 
    FROM   address 
    WHERE  customer_id = :customer_id 
    ORDER  BY CASE 
                WHEN use_frequency IS NULL THEN id 
                ELSE use_frequency 
              END ASC");

.... 

}
</code></pre>

<p>I get the error</p>

<p><code>Fatal error: Call to a member function prepare() on a non-object</code></p>

<p>until i put the <code>include('orderConst_pdo_connect.php')</code> inside the function. Is there a way to include the file  and give the function access to it at the top of the page, or do i need to include it in every function that uses it?</p>
