Hi,
I have a table with quite a few entries in it.
Part of the new layout of my homepage needs to call the entries to preview them.
How could I make it get all the ID's (field name: ID) and select three random ones?
What I have to preview them so far is:
<?php
$con = mysql_connect($server,$user,$pass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name, $con);
$result = mysql_query("SELECT * FROM portfolio");
while($row = mysql_fetch_array($result))
{
echo "<center><h3>".$row['title']."</h3>";
echo "<img height=\"100\" width=\"100\" src=\"".$row['image_path']."\" /><br />";
//Limit number of words shown
$description = substr($row['description'], 0, 99);
//End limit script
echo $description."...<br />";
echo "<div align=\"right\"><a href=\"portfolio.php?id=".$row['id']."\">Read more</a></div>";
echo "<p id=\"port_date\">Date of entry: ".$row['date']."</p>";
echo "</center>";
}
mysql_close($con);
?>
thanks in advance
TreColl