|
Posted by Paul on 05/26/05 22:04
Chris wrote:
> "Geoff Berrow" <blthecat@ckdog.co.uk> wrote in message news:f0sa91p6kbq8n0cl61b42b575smfaup2lu@4ax.com...
>
>>I noticed that Message-ID: <zTWke.15108$WQ3.575@newsfe5-gui.ntli.net>
>>from Chris contained the following:
>>
>>
>>>Also does anyone know how I restrict the very top news item (with image) to the latest news item, by date and also have that
>>>particular news item not included on the list below.
>>
>>Use ORDER BY date DESC
>>
>>For the top item call the function just once.
>>$myrow = mysql_fetch_array($result);
>>//print top row items
>>
>>Calling it again, in a loop, will retrieve the rest of the rows
>>excluding the top item
>>
>>while($myrow = mysql_fetch_array($result)){
>>
>>//print list
>>
>>}
>>
>>--
>>Geoff Berrow 0110001001101100010000000110
>>001101101011011001000110111101100111001011
>>100110001101101111001011100111010101101011
>
>
>
> Geoff,
>
> Exactly where would I put that code, in the recordset code at the top of the page? Sorry for my ignorance, I am very new to PHP.
>
> Also, as you will see, I managed to get the date formatting working.
>
> Thanks,
>
> Chris
>
>
You put that code at the end of your query to mysql...
so if you have something like $query = "select field, field2, field3
from table_name where field3 = "some_value" ORDER BY date_field DESC;
now you gotta plug in your own fields ofcourse.. I just wanted you to
note where the ORDER BY piece went...
If you are using some sort of a mysql handler object .. then all these
functions might not be in your main script.. but in the PHP class file
you include somewhere in your main script...
later..
paul
Navigation:
[Reply to this message]
|