plugnz Posted March 10, 2010 Share Posted March 10, 2010 Hi there, I am building a film scouts website and need to display a lot of images on one page selected via a database. Curently the images are listed vertically on the page but I want them horizontally listed. the code is something like this $query1 = "SELECT category_id, category_name " . "FROM cms_categories " . "ORDER BY category_name"; $results1 = mysql_query($query1,$conn) or die(mysql_error()); while ($row1 = mysql_fetch_array($results1)) { extract($row1); echo '<h2><a href ="search1.php?category=' . $row1['category_name'] . '"><img src=' . htmlspecialchars($row1['category_name']) . "align=\"left\"></a>" . htmlspecialchars($row1['category_name']) . "</h2>"; Thanks in advance Link to comment https://forums.phpfreaks.com/topic/194737-displaying-images-from-database-horizontally/ Share on other sites More sharing options...
5kyy8lu3 Posted March 10, 2010 Share Posted March 10, 2010 Hi there, I am building a film scouts website and need to display a lot of images on one page selected via a database. Curently the images are listed vertically on the page but I want them horizontally listed. the code is something like this $query1 = "SELECT category_id, category_name " . "FROM cms_categories " . "ORDER BY category_name"; $results1 = mysql_query($query1,$conn) or die(mysql_error()); while ($row1 = mysql_fetch_array($results1)) { extract($row1); echo '<h2><a href ="search1.php?category=' . $row1['category_name'] . '"><img src=' . htmlspecialchars($row1['category_name']) . "align=\"left\"></a>" . htmlspecialchars($row1['category_name']) . "</h2>"; Thanks in advance I don't use <h#> tags often so I don't know for sure but try removing those tags, I think they're used for headings so they get their own line, and line break for the proceeding content. Link to comment https://forums.phpfreaks.com/topic/194737-displaying-images-from-database-horizontally/#findComment-1024076 Share on other sites More sharing options...
plugnz Posted March 10, 2010 Author Share Posted March 10, 2010 oh......... That was one of those 'doh' moments...... Thanks heaps! Link to comment https://forums.phpfreaks.com/topic/194737-displaying-images-from-database-horizontally/#findComment-1024090 Share on other sites More sharing options...
plugnz Posted March 10, 2010 Author Share Posted March 10, 2010 ok, I have now been trying to align the text below the images aligning with the left side. with css i can only get the text to sit either side. If I put a <BR> tag between the image and the text the whole thing goes back to aligning vertically again. I'd like to see the images all spaced equally apart from each other with the text aligned to the left of the image. You would think that would be easy ....but... Link to comment https://forums.phpfreaks.com/topic/194737-displaying-images-from-database-horizontally/#findComment-1024150 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.