Charles, it sounds like you want the most recent 9 articles (...order set
to 1 so it shows up first when ...), so why not something like select *
from article_table order by id desc, limit 9 [assumes id is int not null
auto_incremented].
You could also increment the value in the field something like:
$result=mysql_query(select article_order from article table);
while ($array_result=mysql_fetch($result))
{
$article_order=$array_result[article_order]+1;
mysql_query(update article_table set article_order=$article_order where
id=$array_result[id] );
}
hugh
- Original Message -
From: Charles Kline [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 11:10 AM
Subject: [PHP] php, mysql, and method question
hi all,
i have a question about a good method of handling this challenge.
i have a table that contains articles. i have another table which
contains the order 1 - 9 that i would like to display them in.
this part is done, and is not a problem. here is where I am not sure
how to proceed.
1. tbl_display_order - can only have 9 records in it (or do i just
ignore anything beyond 9?)
2. when a new article is added to tbl_display_order - it needs to get
the field that contains it's order set to 1 so it shows up first when I
display the articles, and all the other articles need to have their
order number incremented.
Maybe there is a better way to do this? Just not sure. Maybe not with a
database at all?
Thanks for suggestions.
Charles
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php