Re: Query String
- From: gordonb.1grhg@xxxxxxxxxxx (Gordon Burditt)
- Date: Mon, 29 Dec 2008 13:11:09 -0600
I need a query to firstly retrieve the latest 10 news articles by
date, where I have used ORDER BY and the date field 'timestamp' with
LIMIT. So far so good..
I have then indicated in the database whether each news article has an
image included, marked by the field 'image' and options 'Yes' and
'No'.
To prioritise the news articles to view those with images first, I
have used AND image IN ('Yes', 'No') but I get 'Error in query:
$query'.
You put that in the WHERE clause, not in the ORDER BY clause.
Since you don't have a WHERE clause, you put it in as
WHERE image in ('Yes', 'No')
I don't see where adding this does anything unless the `image` field
has values other than 'Yes' and 'No'.
$query = ("SELECT image, newsid, title, headline, timestamp FROM newsWHERE image IN ('Yes', 'No')
ORDER BY timestamp DESC LIMIT 10");
.
- References:
- Query String
- From: ajtdds
- Re: Query String
- From: ajtrichards@xxxxxxxxxxxxxx
- Re: Query String
- From: Jerry Stuckle
- Re: Query String
- From: ajtdds
- Query String
- Prev by Date: Smarty syntax for require?
- Next by Date: Re: asynchronous PHP
- Previous by thread: Re: Query String
- Next by thread: Re: Query String
- Index(es):
Relevant Pages
|