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] Quote Link to comment 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? Quote Link to comment 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] Quote Link to comment 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' />"; Quote Link to comment Share on other sites More sharing options...
lopis Posted March 13, 2011 Author Share Posted March 13, 2011 Keeps not working Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
lopis Posted March 13, 2011 Author Share Posted March 13, 2011 Thanks mate its fixed :D Quote Link to comment Share on other sites More sharing options...
anevins Posted March 13, 2011 Share Posted March 13, 2011 You're welcome Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.