Welcome to Geeklog, Anonymous Tuesday, June 18 2024 @ 11:24 pm EDT

Geeklog Forums

Show titles of Drafts Block

Status: offline


Forum User
Registered: 05/24/05
Posts: 1
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.

Text Formatted Code

* 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;


All times are EDT. The time is now 11:24 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content