Jump to content

display images with php mysql


priyank

Recommended Posts

Hi,

 

I want to make image gallery with next and previous button and i have to use php and mysql

 

How can i make this. Currently I am displaying all images using following code.

 

But I want to make use of next and previous button and I think it will be more better.

 

  mysql_select_db('a3452924_tImages') or die('Could not select database');

 

    // Performing SQL query

    $query = 'SELECT Image FROM tableImages where imageID = "'.$_GET['dropdown'].'"' ;

    $result = mysql_query($query) or die('Query failed: ' . mysql_error());

 

    // Printing results in HTML

 

while($row = mysql_fetch_array($result))

        {   

          $img = $row['Image'];

  echo"<img src='$img' />";

}

 

      // Free resultset

      mysql_free_result($result);

 

      // Closing connection      mysql_close($link);

?> 

Link to comment
https://forums.phpfreaks.com/topic/158733-display-images-with-php-mysql/
Share on other sites

 

It only requires few lines of code But I don't like to write the code here. Actually, I am using some opensource scripts for doing this. Please make a search on Google or use the following link to get a number of examples:

 

http://www.google.co.in/search?hl=en&rlz=1C1GGLS_enIN323IN323&q=pagination+class+using+php+mysql&btnG=Search&meta=&aq=f&oq=

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.