Matthew Ericson

0 ) { $sqlWhere .= sprintf ( " and itemId in ( select itemId from itemtags where tag like %s ) " , sql_quote( $showTag )); } if ( strlen( $showMonth ) > 0 ) { $sqlWhere .= sprintf ( " and DATE_FORMAT( datePosted, \"%%%%M %%%%Y\" ) like %s ", sql_quote( $showMonth ) ); } if ( strlen( $showId ) > 0 ) { $sqlWhere .= sprintf ( " and itemId = %s ", sql_quote( $showId ) ); } $sql = sprintf ( "SELECT *, DATE_FORMAT( datePosted, \"%%W %%M %%e %%Y\" ) as niceDate, DATE_FORMAT( datePosted, \"%%W %%M %%e %%Y\" ) as niceDate2 FROM items i " . "LEFT JOIN sections s on i.sectionId = s.sectionId " . "LEFT JOIN groups g on i.groupId = g.groupId " . "WHERE i.site = %s and sectionName = %s and i.workflowStatus = 'Publish' " . $sqlWhere . "ORDER BY dateTimePosted DESC ", sql_quote( $site ) , sql_quote( $sectionName ) ); ## echo $sql ; $result = mysql_query($sql) or die('Query failed: ' . mysql_error()); $prev_date = ""; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { if ( $prev_date != get_value( 'niceDate', $row ) ) { ?>