how can i display another set of image on the same page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simon2x1
    New Member
    • Dec 2008
    • 123

    how can i display another set of image on the same page

    i uploaded 5image which is displayed in the respective rows and
    columns.the first image is in the 1row,1coluumn the 3 image is in
    the 1row 3clomn the 5image is in the 2row 2column.i want to echo
    next when the 6image is uploaded and when i click next the same page
    should show displaying the 7image which is just uploaded and is in the
    1row and 1column
    Code:
    <?php
    $db_database = "files";
    $dbconnect = @mysql_connect('localhost','user2','point')or die('could not connect');
    mysql_select_db($db_database) or die('could not select database'); 
    $query = "SELECT * FROM hotel ";
    $result = mysql_query ($query) or die('query error');
    
    echo '<table>';
     $_counter = -1;  // We start 'outside' the Matrix.  Unlike Neo.
     $_cols = 5; // 3 columns.  Of the Ionic variety.
     while( $line = mysql_fetch_assoc($result) )
     {
     $web = $line[web];
     $present = $line[picname];
    // Advance the counter and determine our 'position';
    $_pos = ( ++$_counter % $_cols );
    // Should we output a '<tr>'?
    if( $_pos === 0 )
    {
    echo '<tr>';
    }
    // Output the URL.
    echo "<td><img src='company/$present' width='70' height='68'/></td>";
    // Should we output a '</tr>'?
     if( $_pos === $_cols - 1 )
    {
    echo '</tr>';
    	}
    }
     if( $_counter % $_cols !== $_cols - 1 ){
    do
    {
     echo '<td style="visibility: hidden">&nbsp;</td>';
     }
    while( ++$_counter % $_cols !== $_cols - 1 );
    echo '</tr>';
    } echo '</table>';
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Simon.

    What you're looking for is pagination. You can accomplish this using the MySQL LIMIT clause (MySQL :: MySQL 5.1 Reference Manual :: 12.2.8 SELECT Syntax, look about 1/6 down the page).

    Comment

    Working...