Re: Query String




"Jerry Stuckle" <jstucklex@xxxxxxxxxxxxx> wrote in message
news:gjdbfh$phu$2@xxxxxxxxxxxxxxxxxxxxxx
Richard wrote:
"Jerry Stuckle" <jstucklex@xxxxxxxxxxxxx> wrote in message
news:gjbtem$j60$2@xxxxxxxxxxxxxxxxxxxxxx
Richard wrote:
<ajtdds@xxxxxxx> wrote in message
news:450e389f-4528-458d-9d27-fdf49e4cc3ab@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hey guys I tried it with the array method, and it seemed to work
thanks. Sorry for what might appear to most of you as a
beginners
question.

Anyway I have one last problem.

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'. Any other way to achieve the same effect??

<?php
$query = ("SELECT image, newsid, title, headline, timestamp FROM
news
ORDER BY timestamp DESC AND image IN ('Yes', 'No') LIMIT 10");
$result = mysql_query($query) or die ('Error in query: $query .
' .mysql_error());
You have misplaced the apostrophe in die( ..

Regardless of what Jerry says, this is a simple PHP syntax
thingie.


Richard.
Wrong answer, Richard. A misplaced apostrophe will give a syntax
error. The error he got is a MySQL error from an invalid query.

This is not a PHP problem. It is a MySQL error, and belongs in
either a MySQL newsgroup or a SQL newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================

In fact, the answer is correct, try it yourself:
but I get 'Error in query:$query'.

The error he got was... nothing.

R.



Incorrect. As he stated - he got:

'Error in query: $query'.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================


Hahaha!
You are so funny :D

R.


.



Relevant Pages

  • Re: Query String
    ... Richard wrote: ... I need a query to firstly retrieve the latest 10 news articles by ... To prioritise the news articles to view those with images first, ... It is a MySQL error, and belongs in either a MySQL newsgroup or a SQL newsgroup. ...
    (comp.lang.php)
  • Re: Query String
    ... Sorry for what might appear to most of you as a beginners ... I need a query to firstly retrieve the latest 10 news articles by ... To prioritise the news articles to view those with images first, ... $query = ("SELECT image, newsid, title, headline, timestamp FROM news ...
    (comp.lang.php)
  • Re: Query String
    ... | I need a query to firstly retrieve the latest 10 news articles by ... | To prioritise the news articles to view those with images first, ... timestamp is a database datatype. ...
    (comp.lang.php)
  • Re: Query String
    ... Richard wrote: ... I need a query to firstly retrieve the latest 10 news articles by ... To prioritise the news articles to view those with images first, ... It is a MySQL error, and belongs in either a MySQL newsgroup or a SQL newsgroup. ...
    (comp.lang.php)
  • Re: Query String
    ... I need a query to firstly retrieve the latest 10 news articles by ... To prioritise the news articles to view those with images first, ... this is a simple PHP syntax thingie. ... The error he got is a MySQL error from an invalid query. ...
    (comp.lang.php)