function sectionposts($section_id){
mysql_set_charset('utf8');
$maxpost =mysql_query("SELECT * from posts WHERE section_id = $section_id ORDER BY ID DESC LIMIT 10");
if(mysql_num_rows($maxpost)){
while ($rows = mysql_fetch_array($maxpost, MYSQL_NUM)){
$output[] = $rows;
}
return($output);
}
}
function formatpost($array, $rank){
if(isset($array[$rank])){
$r = $array[$rank];
$output = "<h3>{$r['title']}</h3>";
$output .= "<h4>{$r['subject']}</h4>";
$output .= "<p>{$r['image_post']}</p>";
$output .= "<img src='{$r['some_image']}' />";
return $output;
}
}
$sData = sectionposts(6);
echo formatPost($sData, 0);
...
echo formatPost($sData, 1);
...
echo formatPost($sData, 7);
You could do something like that. NOT TESTED.
diafol
Keep Smiling
10,841 posts since Oct 2006
Reputation Points: 1,675
Solved Threads: 1,536
Skill Endorsements: 61
@weemy
Nice answers and it's so helpful, but i didn't make the point well,
You have to understand that Daniweb is forum where people learn things and share knowledge. What diafol gave is good but you are adding stuff now.
LastMitch
Industrious Poster
4,377 posts since Mar 2012
Reputation Points: 149
Solved Threads: 351
Skill Endorsements: 47