Posted on: 11/09/04 09:15pm
By: Anonymous (MarkB)
I've got a lot of stories coming in and I have one featured, but I'd like to list the others in a static page, after the featured article. I have PHP enabled and all that stuff, but I'm at a loss as to where to start.
Anyone done anything like this before?
I've got my PHP/MySQL book that I'm starting to pour through, but any pointers would be great...
ideally I'd like to show the headline of stories submitted in the last 14 days where feature_stroy = no (if that makes sense)
Feature Block w/ Headline Static Page underneth?
Posted on: 11/10/04 08:30am
By: mrb42
$result = DB_query("Select sid, title,date FROM {$_TABLES['stories']} ORDER BY date DESC");
$nrows = DB_numRows($result);
for ($i = 1; $i <= $nrows; $i++) {
$A = DB_fetchArray($result);
$retval = '<a href="' . $_CONF['site_url'] . '/article.php?story=' . $A['sid'] . '">' . $A['title'] . ' - ' . $A['date'] . '</a><BR>';
}
return $retval;
I'm getting a return, but it's not looping. It's basiclly giving me one article and the query should return all of the stories (right?)
on a side not, it's not returning the entire page, just the query result and the footer. I have it check to wrap in a block... not sure if that's because the query isn't working or what...
Feature Block w/ Headline Static Page underneth?
Posted on: 11/10/04 09:01am
By: Anonymous (tokyoahead)
You have to do $restval.= instead of $retval= inside the loop.
If you would have taken a closer look at the one result you would have seen that its always only giving you the last result. This indicates that it loops well but the output is assemled incorrent.
Feature Block w/ Headline Static Page underneth?
Posted on: 11/10/04 09:06am
By: mrb42
thanks! That was it!