Hey, I'm working on a project and require some help. I have two tables in the same database and I want to query each table using the ID just using one query. It works but it displays the same information more than once even though there is only one entry. For example:
Phillip
Phillip
Phillip
Name
Name
Name
Smith
Smith
Smith
<?php
function connect()
{
$dbh=mysql_connect ("localhost", "root", "root");
mysql_select_db("game");
}
connect();
$q = "SELECT user.title AS user_title, moderators.title AS sub_title FROM users, moderators WHERE user.title = moderators.title GROUP BY moderators.title";
$r = mysql_query($q);
if(mysql_affected_rows() >= 1)
{
while ($row = mysql_fetch_array($r))
{
echo $row['user_title'];
}
}else{
echo 'not ok';
}
?>
Any help please?