code to paste:
<?php
$con = mysql_connect("localhost","root","yourpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$result = mysql_query("SELECT * FROM jos_content where catid='5' order by ID DESC limit 2");
echo "<table border='0' width='215' align='center' cellpadding='0' cellspacing='0'>";
while($row = mysql_fetch_array($result))
{
$dateformatted_a = $row['created'];
//$dateformatted_1 = date("Y-m-d",strtotime($dateformatted_a));
$string= strip_tags($row['introtext']);
$readmorea = substr($string, 0, 50);
echo "<tr>";
echo "<td align='center' valign='top' width='0' align='left'><br><img src='images/stories/". $row['metadesc'] ."' width='70' height='54'></td>";
echo "<td width='214' valign='top' align='left'>";
echo "<table border='0' align='center' width='100%' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td><br><b>" .$dateformatted_1. "</b><br>" .$readmorea. "...</td>";
echo "</tr>";
echo "<tr>";
echo '<td align="right"><br><b><a href="id='.$row['id'].'">» View Articles</a></td>';
echo "</tr>";
echo "<tr>";
echo "<td align='right'> </td>";
echo "</tr>";
echo "</table>";
echo "</td>";
echo "</tr>";
}
echo "</table>";
?>
No comments:
Post a Comment