The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

mysql query help!

to simplify things right down, lets say a row in "games" looks like this :

id | p1id | p2id | level

and "players" :

id | name | surname

how can I, in 1 query, join these 3 queries :

SELECT * FROM games WHERE p1id OR p2id=1 (select all games that player with id=1 has played in)
SELECT * FROM players where id=games.p1id (select player1's details)
SELECT * FROM players where id=games.p2id (select player2's details)

using an inner join, I managed to get the game data and player 1s details in there, but when it comes to player2, there are duplicate field names..how to get around this problem?

MYSQL Form Difficulty

Hello, I sure hope I can get back in and read tehe answers to this post. In MYSQL, I have a PHP and MYSQL database set up for listings on a real estate site, and everything works fine. I can post new entries no sweat adn delete them, However I want to be able to modify the listings I already have. I have created an update listing link that does a loop in PHP_SELF, and it calls the link and doesn't have any errors at all, however the values do not get put into the form, and I am wonderinng if it is possible to have this happen for me. I will post the code. I am also a blind person, so I may not be able to return to get the answer, so if someone has an easy fix for this, please email me ab7jm@cox.net Thank you in advance!
<HTML>
<HEAD><TITLE>Manage Listings</TITLE>
</HEAD>
<BODY>
<?php
if (isset($addlisting)): // If the user wants to add a listing
?>

if you need to join the same table twice in a query, you need to qualify the tables. This means explicitly stating which table you take the information from. This is good practice anyway, as it removes any confusion as to where any of your data is coming from. It's common to use aliases to save a bit of typing.

So, you might do something like this (note the exact syntax may differ slightly depending on which database you're using, but the essence is the same):