Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Building an index for next/last in a photo album.

by davidj (Priest)
on Jul 26, 2004 at 21:29 UTC ( [id://377586] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    img_id | album_id | uid |     name     | ext  
    -------+----------+-----+--------------+------
    ...
        43 |       2  |  12 | vacation_03  | jpg  
        44 |      14  |  89 | mypetcow     | jpg
    
  2. or download this
    img_id | album_id | seq_id | uid |     name     | ext  
    -------+----------+--------+-----+--------------+------
    ...
        42 |       2  |      2 |  12 | vacation_02  | jpg  
        43 |       2  |      3 |  12 | vacation_03  | jpg  
        44 |      14  |      4 |  89 | mypetcow     | jpg
    
  3. or download this
    select seq_id from TABLE where img_id = $img_id
    
  4. or download this
    my $p_seq_id = $seq_id - 1;
    my $n_seq_id = $seq_id + 1;
    
    "select img_id from TABLE where seq_id in ($p_seq_id, $seq_id, $n_seq_
    +id)"