Subject: Show titles of Drafts Block

Posted on: 24/05/05 02:41pm
By: limiter

I am making a DVD/Movie review site (yes yes I know there are too many already, but I don't care) and I made a little block that shows DVD and Movie reviews I am working on (aka listed as draft) but not news drafts.

So the block says "Upcoming Reviews" and lists all the titles of current drafts of reviews. I thought someone else might find this helpful, and it may have been done before- if so sorry 'bout that. I am not the greatest PHP coder, so be kind.

* Show upcoming reviews PHP Block function
function phpblock_showupcomingreviews() {
	$dbserver = 'yourdatabaseserver';
	$usr = 'yourusername';
	$pass = 'yourpassword';
	$db = 'yourdatabase';
	$drafts_query_sql = "SELECT * FROM gl_stories WHERE draft_flag = 1 AND (tid = 'moviereview' OR tid = 'dvdreviews') ORDER BY date"; //you can include more topics by adding 'OR tid ='topicname'
	$drafts_query = mysql_query($drafts_query_sql);
	$drafts_rows = mysql_num_rows($drafts_query);
	if ($drafts_rows != 0) { $retval = $retval . "<ul>"; }
	$d = 0;
	while ($d < $drafts_rows) {
		$drafts_title = mysql_result($drafts_query,$d,'title');
		$retval =  $retval . "<li>" . $drafts_title . "</li>";
	if ($drafts_rows != 0) { $retval = $retval . "</ul>"; }
	return $retval;

Geeklog - Forum