php - Using data from multiple tables -


so here's issue: have 3 tables, overlapping information (specifically, username) in each. except username row isn't named same thing in every table. because username specific user, makes sense other information user based on username. here's have. (the first function returns query, second function returns information in array (or supposed to, anyway).

function get_user_by_id($id) {     global $connection;     $query = "select * ownerorganization, owner, queue_acl";     $query .=" owner.ownerid=ownerorganization.ownerid";     $query .=" , owner.ownerid=queue_acl.user_id";     $query .= " , 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 like, $sel_user = get_user_id(); on page, doesn't pull of selected users information... assume happening because syntax regarding working multiple tables incorrect. anyway, input appreciated. thanks!

to use joins, take snipcode in example :

$query = "select * (ownerorganization inner join owner on owner.ownerid=ownerorganization.ownerid) inner join queue_acl on owner.ownerid=queue_acl.user_id"; $query .=" owner.ownerid ='{$id}'"; 

regards


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -