I just set up my news posting script. But now I want it to show the time and date that I posted a certain news article, how would I go about doing that?
Here's the code for viewing the news if it's helpful.
<html>
<head>
<style type="text/css">
<!--
a:link {color: #33ccff; }
a:visited {color: #ffff00; }
a:active {color: #33ccff; }
a:hover {color: #33ccff; }
-->
</style>
<title>cindango.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#E2007A">
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="color: #FFFFFF; font-family: Arial; font-size: 10pt; border-collapse: collapse" bordercolor="#111111">
<tr>
<td><div align="center">
<table align="center" width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="514"><img src="images/header.gif" width="550" height="71" border="0" usemap="#Map" href="index.php"></td>
</tr>
<tr style="color: #FFFFFF; font-family: Arial; font-size: 10pt; border-collapse: collapse" bordercolor="#111111">
<td bgcolor="#000000">
<?php
switch($page) {
case 'about':
include("../v1/about.php");
break;
case 'portfolio':
include("../v1/portfolio.php");
break;
case 'links':
include("../v1/links.php");
break;
case 'allnews':
include("../v1/allnews.php");
break;
default:
?>
<table width="550" height="350" border="0" cellpadding="0" cellspacing="0" style="color: #FFFFFF; font-family: Arial; font-size: 10pt; border-collapse: collapse" bordercolor="#111111">
<tr valign="top">
<td height="94" colspan="2" bgcolor="#000000" style="padding-top: 10; padding-left: 10;"><img src="images/sitenews.gif" width="215" height="94"></td>
</tr>
<tr>
<td width="540" height="256" valign="top" bgcolor="#000000" style="padding: 25;""><?php
$hostname = "BLAH";
$username = "BLAH";
$password = "BLAH";
$db = "cindang_news";
//Connect to the database server
mysql_connect($hostname, $username, $password) OR DIE("Could not connect to the news database.");
// Tell the database server what database you want to use
mysql_select_db($db) or die("Error selecting News database.");
switch($action) {
case 'viewallnews':
// setup a query variable to ask the database for some information
$query = "SELECT * FROM news ORDER BY date desc LIMIT 5";
// acctualy ask for the info & store it in $results
$result = mysql_query($query) or die("Could not store database info in temporary results.");
print ('');
// create a loop through the database results
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<font color=#33ccff><b>".$row['date']."</b></font>";
echo "<br>";
echo "".$row['newsdata']."";
echo "<p>";
}
break;
default:
// setup a query variable to ask the database for some information
$query = "SELECT * FROM news ORDER BY date desc LIMIT 5";
// acctualy ask for the info & store it in $results
$result = mysql_query($query) or die("Could not store database info in temporary results.");
print (''); }
// create a loop through the database results
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo "<font color=#33ccff><b>".$row['date']."</b></font>";
echo "<br>";
echo "".$row['newsdata']."";
echo "<p>";
}
echo '<a href="index.php?page=allnews">View All News</a>';
?></td>
<td width="36" valign="bottom" bgcolor="#000000">
<div align="right"><img src="images/welcome.gif" width="36" height="250"></div></td>
</tr>
</table>
</td>
</tr>
</table><table width="550" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#E2007A"><font size="1" face="Arial, Helvetica, sans-serif"><a href="http://cindango.com/v1/admin">admin</a>
/ © 2003 <a href="mailto:cindango@hotmail.com">cindy ho</a></font></td>
</tr>
</table>
<?php
}
?>
</div></td>
</tr>
</table>
<map name="Map">
<area shape="poly" coords="4,34" href="#">
<area shape="rect" coords="9,22,132,68" href="index.php?page=about">
<area shape="rect" coords="137,10,234,67" href="index.php?page=portfolio">
<area shape="rect" coords="237,21,333,67" href="index.php?page=links">
<area shape="rect" coords="374,35,551,63" href="index.php">
</map>
</body>
</html>