使用来自多个表的数据

Here's my issue: I have 3 tables, with overlapping information (specifically, the username) in each. Except the username row isn't named the same thing in every table. Because the username is specific to the user, it makes sense to get all the other information about the user based on the username. Here's what I have. (The first function returns the query, the second function returns the information in an array (or is supposed to, anyway).

function get_user_by_id($id) {
    global $connection;
    $query = "SELECT * FROM ownerOrganization, owner, queue_acl";
    $query .=" WHERE owner.ownerId=ownerOrganization.ownerId";
    $query .=" AND owner.ownerId=queue_acl.user_id";
    $query .= " AND owner.ownerId ='{$id}'";
    $result_set = mysql_query($query);
    confirm_query($result_set);
    if ($user = mysql_fetch_array($result_set)) {
        return $user;
    } else {
        return NULL;
    }
}

function get_user_id() {
    if (isset($_GET['ownerId'])) {
        return get_user_by_id($_GET['ownerId']); 
    } 
}

But when I do something like, $sel_user = get_user_id(); on another page, it doesn't actually pull up any of the selected users information... I assume that this is happening because my syntax regarding working with multiple tables is incorrect. Anyway, any input would be much appreciated.

To use JOINS, take this snipcode in example :

$query = "SELECT * FROM (ownerOrganization INNER JOIN owner ON owner.ownerId=ownerOrganization.ownerId) INNER JOIN queue_acl ON owner.ownerId=queue_acl.user_id";
$query .=" WHERE owner.ownerId ='{$id}'";

Regards

I was typing what more or less what @MTranchant wrote. I would suggest renaming your columns for easier query authoring and to avoid confusion. For instance your ownerOrganization.ownerid could be named oo_ownerid, and the other columns in the table could follow that naming convention.

Also, have you run the query against the database with a hard-coded $id that you know exists?

Lastly in the query string being sent to the next page, does a ownerId parameter appear that looks like "&ownerId="?