hi, i'm quite new to php/mysql and i'm just trying to simple pull new from a DB, which i can do
but then i tried it so it theres more than 1 lot of news in one day it only shows the date once, so it SHOULD look like this
date
news bit 1
date 2
news bit 2
news bit 3
but instead of displaying the last news bit or the last in the DB it displays news bit 2 again. i hope you understand this, thanks for any help
this is part of the code,
note $count = 30 or the number of records in the table if its under 30.
$i = 0;
while($i <= $count)
{
$myRow = mysql_fetch_array($result);
$date = substr($myRow['postedDate'], 0, 10);
$time = substr($myRow['postedDate'], 11, 5);
$lastDate = 234;
if ($i > 0) {
mysql_data_seek($result, $i-1);
$lastDate = mysql_fetch_array($result);
$lastDate = $lastDate['postedDate'];
$lastDate = substr($lastDate, 0, 10);
mysql_data_seek($result, $i);
}
if ($date != $lastDate) {
?>
<tr><td><img src="layout/dot_clear.gif" height="3" alt="" border="0"></td>
<tr><td bgcolor="#2F3684" width="30"><img src="layout/icon_sf.gif" width="30" height="25" border="0"></td>
<td bgcolor="#2F3684" valign="middle" width="100%"><span class="headerwhite"> <?php echo($date); ?> </span></td></tr>
<?php
}
?>
<tr><td bgcolor="#191C3A" colspan="2"><span class="header"> <?php echo("[" . $time . "] " . $myRow['title']); ?> </span><br>
<span class="plaintext"> <?php echo($myRow['story']); ?> </span><br><br>
<span class="plaintext">//</span> <a href="mailto:steve@techsurfer.net" class="standardlink"> <?php echo($myRow['poster']); ?> </a><br>
</td></tr>
<?php
$i++;
}
also on a different note, how do you guys do your news? do yous have it a a DB and have a page that you can easily add to it, or is there a better way of doing?
anyway thanks for any help