diff options
author | z0rglub <z0rglub@piwigo.org> | 2004-07-26 20:42:48 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2004-07-26 20:42:48 +0000 |
commit | d119cf334414bdf58e819cb5c6a842abe0d63e51 (patch) | |
tree | 3c75f08d996972c35a45f0872277b28d90ccf71e | |
parent | 16b2b8593403d381432c919441672474cc762c34 (diff) |
- SQL query refactoring
- deletion of "mode" var in URL for searchs
git-svn-id: http://piwigo.org/svn/trunk@454 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | picture.php | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/picture.php b/picture.php index 6f1c7c149..6a1fa28de 100644 --- a/picture.php +++ b/picture.php @@ -54,13 +54,13 @@ if ( 0 ) } // retrieving the number of the picture in its category (in order) -$query = 'SELECT DISTINCT(id)'; -$query.= ' FROM '.IMAGES_TABLE; -$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic'; -$query.= ' ON id = ic.image_id'; -$query.= $page['where']; -$query.= $conf['order_by']; -$query.= ';'; +$query = ' +SELECT DISTINCT(id) + FROM '.IMAGES_TABLE.' + INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id + '.$page['where'].' + '.$conf['order_by'].' +;'; $result = mysql_query( $query ); $page['num'] = 0; $row = mysql_fetch_array( $result ); @@ -87,12 +87,13 @@ if ( $page['num'] == $page['cat_nb_images'] - 1 ) $next = 0; } -$query = 'SELECT *'; -$query.= ' FROM '.IMAGES_TABLE; -$query.= ' INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic'; -$query.= ' ON id=ic.image_id'; -$query.= $page['where']; -$query.= $conf['order_by']; +$query = ' +SELECT * + FROM '.IMAGES_TABLE.' + INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=ic.image_id + '.$page['where'].' + '.$conf['order_by'].' + '; if ( $prev < 0 ) { @@ -142,7 +143,6 @@ for ( $i = 0; $i < $nb_row; $i++ ) if ( $page['cat'] == 'search' ) { $picture[$j]['url'].= '&search='.$_GET['search']; - $picture[$j]['url'].= '&mode='.$_GET['mode']; } } @@ -150,7 +150,7 @@ $url_home = PHPWG_ROOT_PATH.'category.php?cat='.$page['cat'].'&'; $url_home.= 'num='.$page['num']; if ( $page['cat'] == 'search' ) { - $url_home.= "&search=".$_GET['search'].'&mode='.$_GET['mode']; + $url_home.= "&search=".$_GET['search']; } $url_admin = PHPWG_ROOT_PATH.'admin.php?page=picture_modify'; @@ -530,7 +530,7 @@ if ( $conf['show_comments'] ) $url = PHPWG_ROOT_PATH.'picture.php?cat='.$page['cat'].'&image_id='.$_GET['image_id']; if ( $page['cat'] == 'search' ) { - $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode']; + $url.= '&search='.$_GET['search']; } if( !isset( $_GET['start'] ) or !is_numeric( $_GET['start'] ) |