kupe
Technical User
- Sep 23, 2002
- 376
The following filched code works to run a list of available stories on a page and when one is clicked, the full story shows.
But there are problems with it.
1. I would like to Date_Format() NewsDate but none of my variations work.
2. I'd like to be able to use an h tag on Headlines for the initial list of stories. I can make Headline bold, but nothing else works.
Be grateful and immensely relieved for guidance.
if($id) {$result = mysql_query("SELECT * FROM studentnews WHERE NewsID=$id", $db);
$myrow = mysql_fetch_array($result);
printf("<h4>%s\n</h4>", $myrow["Headline"]);
printf(" %s\n<br>", $myrow["NewsStory"]);
printf("<div class=\"names\">- %s</div>", $myrow["Byline"]);
printf("Bulletin: %s", $myrow["NewsDate"]);
} else {
//show archives list
$result = mysql_query("SELECT * FROM studentnews ORDER BY NewsDate DESC", $db);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<a href=\"%s?id=%s\"> <b>%s</b></a><br> %s\n<br> %s\n<p></p>",
$PHP_SELF,$myrow["NewsID"], $myrow["Headline"], $myrow["Blurb"], $myrow["NewsDate"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, nuttin' found";
}
}
But there are problems with it.
1. I would like to Date_Format() NewsDate but none of my variations work.
2. I'd like to be able to use an h tag on Headlines for the initial list of stories. I can make Headline bold, but nothing else works.
Be grateful and immensely relieved for guidance.
if($id) {$result = mysql_query("SELECT * FROM studentnews WHERE NewsID=$id", $db);
$myrow = mysql_fetch_array($result);
printf("<h4>%s\n</h4>", $myrow["Headline"]);
printf(" %s\n<br>", $myrow["NewsStory"]);
printf("<div class=\"names\">- %s</div>", $myrow["Byline"]);
printf("Bulletin: %s", $myrow["NewsDate"]);
} else {
//show archives list
$result = mysql_query("SELECT * FROM studentnews ORDER BY NewsDate DESC", $db);
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<a href=\"%s?id=%s\"> <b>%s</b></a><br> %s\n<br> %s\n<p></p>",
$PHP_SELF,$myrow["NewsID"], $myrow["Headline"], $myrow["Blurb"], $myrow["NewsDate"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, nuttin' found";
}
}