I've never written my own function - although I've hacked up a few in the past.
This function just outputs some entries from a blog I'm toying around with today.
I'm really trying to learn how to write functions now to get my newb skills to a higher level.
What can I do to tighten this up - oh yes, this is working AOK as it is...
Thank...v
function getEntries($user) {
$s = "";
$query = mysql_query ("SELECT * from main,users,templates,sections WHERE main.mainsecid=sections.secid AND main.maintemplid=templates.templid AND main.mainmid='1' AND main.mainusid='$user' ORDER BY pdate DESC, ptime DESC LIMIT 0,6");
$row = mysql_fetch_array($query);
}
if (!mysql_num_rows($query)) { $s = "Sorry, but those files are being updated right now."; }
else { do {
$s .= "<h1>$row[title]</h1>\n";
$s .= "$row[text]\n";
$s .= "<br /><br />";
} while ($row = mysql_fetch_array($query)); }
echo $s;
}