Jump to content

Archived

This topic is now archived and is closed to further replies.

Sware

Not unique table/alias

Recommended Posts

I was doing fine and all of a sudden..

Bam!
Not unique table/alias: 'phpbb_posts'

I'm new to MySQL and trying to create a portal with phpBB.

$query = "SELECT phpbb_posts.poster_id, phpbb_users.username ".
"FROM phpbb_posts, phpbb_users".
"WHERE phpbb_posts.poster_id = phpbb_users.poster_id";

$result = mysql_query($query) or die(mysql_error());


// Print out the contents of each row into a table
while($row = mysql_fetch_array($result)){
echo $row['poster_id'];
echo $row['username'];
echo "<br />";
}

Just a little test but it shows that error, ANY help will be thanked for.

Share this post


Link to post
Share on other sites
That is an unusual error... do you get the same error when you convert that query to proper join syntax?

Share this post


Link to post
Share on other sites
$query = "SELECT phpbb_posts.poster_id, phpbb_users.username FROM phpbb_posts, phpbb_users WHERE phpbb_posts.poster_id = phpbb_users.poster_id"; 

something like that? yes.

Share this post


Link to post
Share on other sites
No, something like:

[code]SELECT phpbb_posts.poster_id, phpbb_users.username FROM phpbb_posts JOIN phpbb_users ON phpbb_posts.poster_id = phpbb_users.poster_id[/code]

Share this post


Link to post
Share on other sites
How do I add another join onto that
[code]SELECT phpbb_posts.poster_id, phpbb_users.username FROM phpbb_posts JOIN phpbb_users ON phpbb_posts.poster_id = phpbb_users.poster_id (+ ANOTHER JOIN)[/code]

or can you not do that?

Share this post


Link to post
Share on other sites
Simply add another JOIN newTable ON ( condition).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.