lopis Posted March 13, 2011 Share Posted March 13, 2011 I want to display the images that i have uploaded, and they are stored in my database, but when i try to display them, they dont show very well, need help!! <html> <title> Produtos </title> <body bgcolor="#99CCCC"> <center><font face = "Agency FB" size="6"> Listar Porto </font> <br><br> <?php $ligacao=mysql_connect('localhost','root','') or die("Problema na ligação ao MySQL"); mysql_select_db("site"); $sql = "select * from productos"; $result = mysql_query($sql) or die ("Nao consegui ligar a db"); while($row=mysql_fetch_assoc($result)) { echo "<div class=\"Image\">"; echo "<p>"; // Note that we are building our src string using the filename from the database echo "<img src=\"Image/" . $row['imagelocation'] . "\" alt=\"\" height='100' width='100' />"; echo $row['nome'] . " " . $row['marca'] . ""; echo "</p>"; echo "</div>"; } mysql_close(); ?> </body> </html> [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/ Share on other sites More sharing options...
anevins Posted March 13, 2011 Share Posted March 13, 2011 You're definate the names you've used are the same as your table columns? Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187127 Share on other sites More sharing options...
lopis Posted March 13, 2011 Author Share Posted March 13, 2011 Yeah they are!! [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187129 Share on other sites More sharing options...
anevins Posted March 13, 2011 Share Posted March 13, 2011 Is it to do with those dots you have before your images in the database? Try: echo "<img src=\"Image/." . $row['imagelocation'] . "\" alt=\"\" height='100' width='100' />"; Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187130 Share on other sites More sharing options...
lopis Posted March 13, 2011 Author Share Posted March 13, 2011 Keeps not working Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187133 Share on other sites More sharing options...
anevins Posted March 13, 2011 Share Posted March 13, 2011 Sorry, I've just realised you are trying to find an image folder inside an image folder. Your database shows the full directory, therefore you needn't include the image folder within your html code. Unless you have an image folder within an image folder. Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187134 Share on other sites More sharing options...
lopis Posted March 13, 2011 Author Share Posted March 13, 2011 Thanks mate its fixed :D Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187135 Share on other sites More sharing options...
anevins Posted March 13, 2011 Share Posted March 13, 2011 You're welcome Link to comment https://forums.phpfreaks.com/topic/230546-display-uploaded-images/#findComment-1187136 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.