View Full Version : Problems with img src

05-09-2009, 01:10 AM
Hi, I'm trying to display some images using the img src, but there is a problem when I do it dinamically, but if I do it specifing the name of the image there is no problem. Here is my code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>

<form method="post">
<table border="0" aling="center">
$query="SELECT * FROM $tablename;";
$result=mysql_db_query ($dbname, $query, $created_link);
echo $row['Nombre_Imagen'];
<td align="center"><img src="http://localhost/Clientes/Galeria/<?=$row['Nombre_Imagen']?>"
height="120" width="200"/></td>

I dont know what happens but the images dont appear, and I cheked the name stored in the variable and the name is correct, and that name, saves the extension too. I don't know what happend.

05-09-2009, 01:18 AM
<img src="http://localhost/Clientes/Galeria/<?php echo $row['Nombre_Imagen']; ?>"
height="120" width="200"/>

Try that. :)

Your php inside that tag was just a variable, you have to actually echo/print it to get an output.

05-09-2009, 01:19 AM
What does a "view source" of your page in the browser show?

05-09-2009, 03:11 AM
Hi Auax, thank you!! it worked really good... thank you again.