All pastes #554218 Raw Edit

Anonymous

public php v1 · immutable
·published 2007-06-10 01:49 UTC
rendered paste body
<?php                $journal_query = 'SELECT entries.*, pictures.id AS picture_id, pictures.comment, pictures.filename, pictures.entry_id FROM entries LEFT JOIN pictures ON entries.id=pictures.entry_id ORDER BY datetime;';                $journal_result = mysql_query($journal_query);                    if(!$journal_result) {                        die(mysql_error());                    }                unset($prev_entry_id);                $update_count = 0;                while($journal_row = mysql_fetch_assoc($journal_result)) {                    if($journal_row['id'] != $prev_entry_id) {                        if($update_count > 0) {                            echo "\t\t\t</div>\n";                        }                        echo "<div class=\"update\">                <div class=\"date\">                    {$journal_row['datetime']}                </div>                <div class=\"body\">                    {$journal_row['body']}                </div>\n";                        if(isset($journal_row['filename'])) {                            echo "\t\t\t\t<div class=\"picture\">                    <a href=\"pictures/{$journal_row['filename']}\"><img src=\"pictures/thumbnails/{$journal_row['filename']}\" alt=\"{$journal_row['filename']}\" /></a>                </div>\n";                        }                        $prev_entry_id = $journal_row['id'];                        $update_count++;                    }                    else {                        echo "\t\t\t\t<div class=\"picture\">                    <a href=\"pictures/{$journal_row['filename']}\"><img src=\"pictures/thumbnails/{$journal_row['filename']}\" alt=\"{$journal_row['filename']}\" /></a>                </div>\n";                        $prev_entry_id = $journal_row['id'];                    }                }                echo "\t\t\t</div>\n";            ?>