未定义变量:不显示数据

Basically trying to filter out records from an ID sent via POST.

Below is the function I am running.

 function displayinvoice($supid){
    $result = mysql_query("SELECT * FROM companies WHERE compID = " . $supid);
    $row = mysql_fetch_array( $result );
    return $row;

This is the on the page code

include '../inc/functions-jams.php';

$dropid = $_POST['cmyid'];

displayinvoice($dropid);

And I have this in the body of the doc

<? echo $row['compName'];?>

Now $dropid is picking up as I have echoed it out on the page but the body code is returning this error.

Notice: Undefined variable: row in C:\xampp\htdocs\yourwedding\backend\sup-invoices-02.php on line 59

Been at it for a few hours now and getting nowhere. Any help much appreciated.

You are not getting the returned value:

$row = displayinvoice($dropid);

Ok aside from the SQL Injection issues...

Try

$row = displayinvoice($dropid);

<? echo $row['compName'];?>