All pastes #520695 Raw Edit

Mine

public php v1 · immutable
#520695 ·published 2007-05-30 00:33 UTC
rendered paste body
<?php        $posts_query = 'SELECT posts.*, pictures.title AS pictures_title, pictures.comment, pictures.filename, pictures.post_id FROM posts LEFT JOIN pictures ON posts.id=pictures.post_id ORDER BY datetime;';        $posts_result = mysql_query($posts_query);          if(!$posts_result) {            die(mysql_error());          }        unset($prev_post_id);        unset($prev_picture_id);        while($posts_row = mysql_fetch_assoc($posts_result)) {          if($posts_row["id"] != $prev_post_id) {          echo "<div class=\"post\">        <div class=\"title\">          <span class=\"title\">$posts_row[title]</span>        </div>        <div class=\"datetime\">          <span class=\"datetime\">$posts_row[datetime]</span>        </div>        <div class=\"body\">          <span class=\"body\">$posts_row[body]</span>        </div>\n";          }          //if($posts_row["filename"] != $prev_picture_id) {          if(isset($posts_row['filename'])) {          echo "        <div class=\"picture\">          <a href=\"pictures/$posts_row[filename]\"><img src=\"pictures/thumbnails/$posts_row[filename]\" alt=\"$posts_row[pictures_title]\" /></a>        </div>\n";          $prev_post_id = $posts_row['id'];          }          else {            echo "</div>";            $prev_picture_id = $posts_row['filename'];          }        }      ?>