Hi,
I'm currently writing a function to display news items from a database in DIV layers. Though I'm currently experiencing a few troubles. The first of these is that the boxed seem to appear randomly instead of where the code suggests. Secondly, the fixed increment for the positions need to be altered so that they increment depending on the number of lines the previous news item uses.
Any ideas?
function getLatestNews(){
$db = mysql_connect("localhost","*","");
mysql_select_db("jedi58_uk_db",$db);
$query = "SELECT FROM news WHERE 1 ORDER BY 'posttime' DESC LIMIT 5";
$result = mysql_query ($query,$db);
$newsHTML="";
$titleTop=133;
$titleTop=137;
$titleTop=150;
if ($record = mysql_fetch_array($result)) {
do {
$postTitle = $record["newstitle"];
$postContent = $record["newsdesc"];
$postUser = $record["poster"];
$postTime = $record["posttime"];
$newsHTML .= "<div class='newstitle' style='position: absolute;left: 166px; top: ".$titleTop."px;'>".$postTitle."</div>";
$newsHTML .= "<div class='posterText' style='position: absolute;left: 420px; top: ".$titleTop2."px;zindex=2'> - Posted by ".$postUser." @ ".$postTime."</div>";
$newsHTML .= "<div class='newsbody' style='position: absolute; left: 166px; top: ".$titleTop3."px;'>";
$newsHTML .= $postContent."</div>";
$titleTop .= 220;
$titleTop2 .= 224;
$titleTop3 .= 237;
} while ($record = mysql_fetch_array($result));
} else {
echo ("No News Items Found. If you are experiencing trouble please contact the site Administrator");
}
return $newsHTML;
}//getLatestNews()