Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problems with img src

    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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Documento sin título</title>
    </head>

    <form method="post">
    <table border="0" aling="center">
    <?php
    include("ConectarABaseDeDatos.php");
    $created_link=Conectarse();
    $dbname="Reparto";
    $tablename="Clientes";
    $query="SELECT * FROM $tablename;";
    $result=mysql_db_query ($dbname, $query, $created_link);
    while($row=mysql_fetch_array($result))
    {
    ?>
    <?php
    echo $row['Nombre_Imagen'];
    ?>
    <td align="center"><img src="http://localhost/Clientes/Galeria/<?=$row['Nombre_Imagen']?>"
    height="120" width="200"/></td>
    <?php
    }
    ?>
    </table>
    </form>
    <body>
    </body>
    </html>


    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.

  • #2
    New Coder
    Join Date
    May 2009
    Posts
    13
    Thanks
    1
    Thanked 0 Times in 0 Posts
    PHP Code:
    <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.

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,147
    Thanks
    2
    Thanked 333 Times in 325 Posts
    What does a "view source" of your page in the browser show?
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #4
    New to the CF scene
    Join Date
    May 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Auax, thank you!! it worked really good... thank you again.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •