[PHP-DB] problem with where clause

2002-07-24 Thread JJ Harrison

Here is my query(It is part of a search script and is dynamicly generated):

select 0 + article_keyword.weight * article_keyword.keyword like '%green%'
as score, article_keyword.aid, article_data.name, article_data.time,
article_data.description from article_keyword, article_data where score  0
and article_data.aid = article_keyword.aid group by article_data.aid order
by score desc

when I do the query in PHP I get a message saying: Unknown column 'score' in
'where clause'.

How can I fix this?


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] problem with where clause

2002-07-24 Thread Russ

In MySQL - SQL you can't use the column alias ('score' in your case)
until after the query has been executed.

There is a workaround though - see:
http://www.sitepointforums.com/showthread.php?s=postid=501671 for more
info.

Cheers.
Russ

-Original Message-
From: JJ Harrison [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 4:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] problem with where clause


Here is my query(It is part of a search script and is dynamicly
generated):

select 0 + article_keyword.weight * article_keyword.keyword like
'%green%'
as score, article_keyword.aid, article_data.name, article_data.time,
article_data.description from article_keyword, article_data where score
 0
and article_data.aid = article_keyword.aid group by article_data.aid
order
by score desc

when I do the query in PHP I get a message saying: Unknown column
'score' in
'where clause'.

How can I fix this?


--
JJ Harrison
[EMAIL PROTECTED]
www.tececo.com




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php