I'm pretty new to PHP coding and as some practice I've been working on a small site. At the moment I'm trying to make a mod for my homepage that links to my blog to show the latest posts. I've made it all and it works but I want to try and limit the length of the characters displayed and also try and reformat the date.
$query = "SELECT * FROM wp_posts ORDER BY ID DESC LIMIT 4";
$result = mysql_query($query)
or die ("no query");
echo "<table cellspacing='2'>";
echo "<tr><td colspan='2'></td></tr>";
while ($row = mysql_fetch_array($result))
{
extract($row);
echo "<tr>\n
<td> <a href='/wordpress/?p=$ID'>$post_title</a></td>\n
<td> $post_date_gmt</td>\n
</tr>\n";
echo "<tr><td colspan='2'></td></tr>\n";
}
echo "</table>\n";
thats the code, I've done so far. $post_title is the bit I want to limit.
Also the date is displayed as YYYY/MM/DD-HH/MM/SS, is there anyway I can re-format this using PHP?
Thanks
