I am trying to learn how to use JOIN
, INNER JOIN
, LEFT JOIN
and RIGHT JOIN
.
I have the following users and generator tables
users
uid
username
password
email
and
creator
id
uid
g_name
g_bio
But I cannot join them. I try to JOIN
like this :
public function Generator($uid) {
$g_name=mysql_real_escape_string($uid);
$query= mysql_query ("SELECT username,g_name,g_bio FROM users JOIN creator ON users.uid = creator.uid");
$data=mysql_fetch_array($query);
return $data;
}
But print_r
does not show anything? What is wrong here?