Re: Query for two fields with the same name
| From: | Jochem Maas | Date: | Wed, 19 Apr 2006 23:01:22 +0000 |
| Subject: | Re: Query for two fields with the same name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234318@lists.php.net to get a copy of this message | ||
NOT a php question.
Kevin Murphy wrote:
This is probably a simple question, but I can't seem to find the answer online. I'm using this query: $connection = "select * from connection, pr WHERE connection.area_id = '$gateway_link' and connection.pr_id = pr.id";doing "SELECT * FROM bla" is not recommended, better to actually specify _just_ the fields you need. "SELECT c.id AS cid, p.id AS pid FROM connection AS c, pr AS p WHERE ... " this stuff can be found in the mysql docs.
Both tables have a field called ID but they have different information in them. $row['id'] gets me the one from the table called "pr" but I need to call the ID from the table connection.