Browsers retrieve and display each image via separate HTTP requests. If you output the image data for multiple images in one script, then you are trying to send them all to the browser in one request. What I suspect is happening is that the browser starts receiving the image data, reads the first part of it to determine what kind of image it is (and probably other meta-data like how many bytes it is), then when it gets to the end of the first image's data, it regards any further incoming data as invalid and discards it.
Instead, you will need an 'image server' script to serve up individual images, then your main page will instead output multiple <img> tags that each call that server script, probably with a value in the URL query string to specify the image id, which will then be used in the DB query to retrieve the image data. This means each image's display will require a separate database connection, query, retrieval, and output. This is one of the main reasons it is usually more practical to store the images as files and just use the database to store data about those images, including the file name (and possibly directory) needed to populate your <img> tags.