$mattIncPath = $_SERVER["DOCUMENT_ROOT"]; ini_set("include_path", ini_get("include_path"). PATH_SEPARATOR .$mattIncPath); include 'include/styles.php'; include 'include/config.php'; ## Library functions include 'include/lib.php'; include 'include/db.php'; $action = get_value( 'action', $_REQUEST ); $script_url = $_SERVER["PHP_SELF"]; ## Connect to mysql db $link = mysql_connect($db_server, $db_username, $db_password) or die('Could not connect: ' . mysql_error()); mysql_select_db($db_name) or die('Could not select database'); fix_magic_quotes();?>
## do the blog here $site = "home"; $sectionName = "InfoVis 2007"; $showTag = get_value( 'showTag', $_REQUEST ); $showMonth = get_value( 'showMonth', $_REQUEST ); $showId = get_value( 'showId', $_REQUEST ); $sqlWhere = ""; if ( strlen( $showTag ) > 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 ) ) { ?> |