Matthew,
My MySQL syntax is a little rusty. But if you define tables as type
"MYISAM" and implement a primary key like this "nArticleKey integer
unsigned not null auto_increment primary key" you will have a steadily
incrementing count on your articles, as you add them, with no intervention.
You could then issue as select statement like " select * from articles
limit 7 order by nArticleKey descending" (maybe it should be "top" instead
of "limit", check your MySLQ syntax) and feed those to the front page.
Store your lowest of the retrieved article numbers, in $lownum, then for
the archive, "select * from articles where nArticleKey < $lownum descending".
Wrangling the results out to the page, etc. I leave to you.
Maybe you've done all of this already and I'm just wasting keystrokes? Let
me know how it goes, I will go have a look at the page.
Regards - Miles
At 10:28 PM 2/28/01 +0000, Matthew Cothier wrote:
>>From: [EMAIL PROTECTED] (Miles Thompson)
>>To: [EMAIL PROTECTED],[EMAIL PROTECTED]
>>Subject: Re: [PHP-DB] Selecting number of news items on frontpage
>>Date: Wed, 28 Feb 2001 17:06:07 -0400
>>
>>Matthew,
>>
>>Do you want to be told how, or want to read an interesting article on just
>>this, including PHP script to build your archives. It's one of the early
>>PHP tutorials -- try a search on "php movie database".
>>
>>I adapted code from that for my own archive, although I run a shell script,
>>logged in as root, to actually make the directory and copy the files. That
>>has mostly to do with security, although it could probably be overcome by
>>having the archive directory owned by whatever name the webserver runs as.
>>
>>Miles
>>
>>PS Ah, just found it:
>>http://www.webreview.com/pub/2000/02/11/php/index.html That will take you
>>to their archive. Good luck!!
>>
>>PPS The shell script just prompts for a directory name and creates the
>>directory, then copies all files from the web site root into the newly
>>created directory. A second script publishes the new files.
>>
>>
>>Have fun!!!
>
>
>Basically I am using PHP and MySql, is there no way of just grabbing the
>last 7 articles entered into the database and displaying them and then
>linking to a page with the rest of them (ie. All the others minus the last
>7 - the ones on the front page)?
>
>
>What loop code would I need for this, its a friends site that I have just
>started :
>
>www.sunsetbeachuk.com Thats the url if it helps to take a look, as you
>will see the front page just grows and grows as more news is added........
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]