I have a table listing products where each row corresponds to each product's data. One of the row's cell is the product image, which would be uploaded via its path (that is stored in the database). Is it possible to display an image on that cell (not as background).
You mean something like this (very simplified of course): <table> <tr> <td>Product Description</td> <td><img "src=/path/file.jpg" /></td> </tr> </table> Does this answer your question?
First of all, thanks for replying. Yeah, theoretically that would work, i've tried it, but it show nothing but the same small image icon regardless of the image i try to input. Why is this? Please help me on this everyone, it's really important for me that you do.
Maybe you're getting the file paths wrong? I know, you're probably going to think that this is silly, but honestly, web designers are people, and people make mistakes. I do this sort of thing all the time, and then wake up the next day wondering how I got it wrong. Also, another silly thing: .jpeg is different to .jpg (Just in case) Otherwise, I don't know what the problem might be...
I would do this slightly differently - which may be your problem Notice I've put the quote mark in a different place. Use the full path of your image file (just to be sure) and make sure you've uploaded the image to the correct folder on your server.
Thanks for the replies people. Yeah, I've tried to put the full image path (which came in handy because I was trying to acess the images from an all different location as well), but the image does not display. It is there, I've checked it, but all that appears is something like an image error box. I even tried to put it as background, and it didn't work. Here's my code: [CODE]$query=mysql_query("SELECT * FROM produtos",$connection); $registos=mysql_num_rows($query); for($i=0;$i<$registos;$i++){ $dados = mysql_fetch_assoc($query); $query_imagem=mysql_query("SELECT * FROM imagens WHERE produto=".$dados['id_produto']."",$connection); $imagem = mysql_fetch_assoc($query_imagem); if($dados['reservado']!=1){ echo "<tr align=center> <td>".$dados['nome']."</td>"; echo "<td>".$dados['marca']."</td>"; echo "<td>".$dados['preco']." €</td>"; echo "<td>".$dados['quantidade_stock']."</td>"; echo "<td><input type='text' size='1' name='text_".$dados['id_produto']."'></td>"; echo "<td background ='".$imagem['path']."'></td>"; echo "<td align=right><input type='submit' name='button_".$dados['id_produto']."' value='Reservar'> <input type='hidden' name='pro[]'></a></td>"; echo "</tr>";}[/CODE] PHP: I'm trying to associate the image with the respective product's id. What is wrong here? Please help.
I didn't notice that Another thing to do, would be to check file permissions on the picture file, especially if you're using Windows.