I am writing a program where I repeat this code on numerous pages:
PHP Code:
$shipping_query=("SELECT * FROM `shipping` WHERE `mra_number`='$mra_number'");
$shipping_result mysql_query($shipping_query);
    while(
$ship=mysql_fetch_array($shipping_result)) {
        
$c_fname=$ship['fname'];
        
$c_lname=$ship['lname'];
        
$c_company=$ship['company'];
        
$c_distributor=$ship['distributor'];
        
$c_email=$ship['email'];
        
$c_phone=$ship['phone'];
        
$c_address1=$ship['address1'];
        
$c_address2=$ship['address2'];
        
$c_city=$ship['city'];
        
$c_state=$ship['state'];
        
$c_zip=$ship['zip'];
        
$c_country=$ship['country'];

I would like to turn this into a function that I can just include. This is what I wrote and it doesn't seem to be working:
PHP Code:
function shipQuery($mra_num) {
$shipping_query=mysql_query("SELECT * FROM shipping WHERE mra_number='$mra_num'");
    while(
$ship=mysql_fetch_array($shipping_query)) {
        
$ship['fname'] = $c_fname;
        
$ship['lname'] = $c_lname;
        
$ship['company'] = $c_company;
        
$ship['distributor'] = $c_distributor;
        
$ship['email'] = $c_email;
        
$ship['phone'] = $c_phone;
        
$ship['address1'] = $c_address1;
        
$ship['address2'] = $c_address2;
        
$ship['city'] = $c_city;
        
$ship['state'] = $c_state;
        
$ship['zip'] = $c_zip;
        
$ship['country'] = $c_country;
    }
    
    return 
$ship;

If I try and echo $c_fname, the screen is blank. Any ideas?