// result.php require( 'config.php' ); require( 'lib.php' ); // if ( $_GET['page'] == '' ) $_GET['page'] = 0; if ( $_GET['rows'] == '' ) $_GET['rows'] = 20; if ( $_GET['sort'] == '' ) $_GET['sort'] = 'item_name asc'; // session_start(); // db connect $link = mysql_connect( $db_host, $db_user, $db_password ); mysql_select_db( $db_name ); $result = mysql_query( 'set character set utf8' ); // if ( $_GET['author_id'] != '' ) $where .= "item.author_id = '" . mysql_real_escape_string( $_GET['author_id'] ) . "' and "; if ( $_GET['category_id'] != '' ) $where .= "category_id = '" . mysql_real_escape_string( $_GET['category_id'] ) . "' and "; if ( $_GET['query'] != '' ) $where .= "item_name like '%" . mysql_real_escape_string( $_GET['query'] ) . "%' and "; $where .= 'item_id > 0'; $sql = "select * from item where $where"; $result = mysql_query( $sql ); $num_rows = mysql_num_rows( $result ); $sql = "select * from item left join author on item.author_id = author.author_id where $where order by " . mysql_real_escape_string( $_GET['sort'] ) . " limit ${_GET['page']}, ${_GET['rows']}"; $result2 = mysql_query( $sql ); //echo $sql; // $delta = 3 * $_GET['rows']; if ( $_GET['page'] - $delta < 0 ) $s = 0; else $s = $_GET['page'] - $delta; if ( $_GET['page'] + $delta > $num_rows ) $e = $num_rows; else $e = $_GET['page'] + $delta; ?> require( 'header.php' ) ?> require( 'topbar.php' ) ?>
|
価格 円(税込み) |