Re: display array problem
| From: | Chris | Date: | Wed, 15 Mar 2006 04:31:47 +0000 |
| Subject: | Re: display array problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231923@lists.php.net to get a copy of this message | ||
Mark wrote:
Can anyone help me with this problem please!
the code below shows a football fixture for the entire season , round 1-22 but this takes up to much space on the webpage (very long page).
Is it possible to display one round at a time so its automatic.
At the moment- each week the admin closes a round ie: (round 2 closed) so i want the page to display round 3 fixtures only for the entire week.
Can a script show the next round after the closed round (if round 1 is closed go to next round -2- if thats closed go to next round which is 3, until it gets a round thats not closed and shows the results.
The table
FIXTURES
Field Type Null Default
id int(11) No
round char(2) No 0
game int(11) No 0
date text No
home text No
away text No
winner text No
draw text No
closed char(1) No 0
comp_id int(11) No 0
margin int(11) No 0
I assume 'closed' becomes '1' when it's over.
change
SELECT * FROM fixtures WHERE comp_id = $comp_id
to
SELECT * FROM fixtures WHERE comp_id = $comp_id WHERE closed='0' ORDER BY round ASC LIMIT 1;
The limit 1 will stop it fetching all rounds - if you don't want that, remove the "limit 1".
--
Postgresql & php tutorials
http://www.designmagick.com/