...

View Full Version : Getting Past an Ambiguous Field



WarGiant
07-02-2002, 11:01 PM
I am making a news script that loads all the news for the site from the forum.
however, i have run into a problem.
the posts are stored in 2 tables,
ccphpbb_posts has the post time, authors, forum id, and such.
ccphpbb_posts_text has the post subjects and messages.

heres my problem, both tables have a feild called post_id, which has the id number for the post, but since there are 2 of the same filed in the query it causes an error with says DBD::mysql::st execute failed: Column: 'post_id' in field list is ambiguous

anyone have any idea how to get around that?

heres my query (note: im using perl)
SELECT post_id, forum_id, poster_id, post_time, post_subject, post_text, user_id, username, user_rank, user_avatar, user_sig FROM ccphpbb_posts, ccphpbb_posts_text, ccphpbb_users WHERE ccphpbb_posts.post_id=ccphpbb_posts_text.post_id ORDER BY post_id DESC

Spookster
07-03-2002, 12:26 AM
In your SELECT statement you need to identify from which table you wish to select that particular field

SELECT ccphpbb_posts.post_id, ccphpbb_posts_text.post_id

WarGiant
07-03-2002, 01:56 AM
would doing that chnage how i would acess the info once its retrived?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum