Page 1 of 1

[SOLVED]Dual tableselect problems

Posted: Sun Dec 18, 2005 1:36 pm
by evilmonkey
This query is giving me problems, I wonder if someone can tell mewhat I'm doing wrong.

Code: Select all

mysql_query("SELECT * FROM `users` AS users, `favourites` AS favourites WHERE
			`favourites.user_id` = $this->userid AND `favourites.type` = '$type'
			ORDER BY `users.popularity` DESC");
The error that I get is: Unknown column 'favourites.user_id' in 'where clause'.

Help appreciated. Thanks. :)

Posted: Sun Dec 18, 2005 1:40 pm
by hawleyjr
Is there a column named user_id in the favourites table?

Posted: Sun Dec 18, 2005 1:47 pm
by evilmonkey
Yes. :?

Posted: Sun Dec 18, 2005 1:52 pm
by evilmonkey
Iseem to have finxed it. The problem was with the ` character around favourties.user_id. If someone could elaborate on when those ticks areneeded, I'd really appreciate it.

Posted: Sun Dec 18, 2005 2:52 pm
by ody
evilmonkey wrote:Iseem to have finxed it. The problem was with the ` character around favourties.user_id. If someone could elaborate on when those ticks areneeded, I'd really appreciate it.
viewtopic.php?t=41318

Posted: Sun Dec 18, 2005 4:58 pm
by John Cartwright
to sum it up

Code: Select all

`tablename`.`columnname`
not

Code: Select all

`tablename.columname`

Posted: Sun Dec 18, 2005 5:05 pm
by evilmonkey
Yes...that would make sense. Thanks, problem solved. :D