Insert JPG created with information from a DB in HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bettina@coaster.ch

    Insert JPG created with information from a DB in HTML

    I look in my DB for a CODE. I find it and now I want to show the jpg
    corresponding to this CODE in html. Here is my piece of code, however
    the photo will not be shown....

    <?php
    -
    -
    -

    $posavaso=mysql _fetch_field($r esult,CODE);
    while ($row = mysql_fetch_ass oc($result)) {

    $posavaso= $row["CODE"].".jpg"; //here I create my jpg
    }
    }
    ?>
    <img src="../Fotos/<? $posavaso?> width="215" height="108">

    ....

    any tips???

  • chotiwallah

    #2
    Re: Insert JPG created with information from a DB in HTML

    there is a " missing after <? $posavaso?> which appends "width=" to
    all of your fiel names

    micha

    Comment

    • bettina@coaster.ch

      #3
      Re: Insert JPG created with information from a DB in HTML



      chotiwallah schrieb:[color=blue]
      > there is a " missing after <? $posavaso?> which appends "width=" to
      > all of your fiel names
      >
      > micha[/color]


      I tried but it doesn't work.......
      Bettina

      Comment

      • Alvaro G Vicario

        #4
        Re: Insert JPG created with information from a DB in HTML

        *** bettina@coaster .ch wrote/escribió (26 Jun 2005 12:58:53 -0700):[color=blue]
        > <img src="../Fotos/<? $posavaso?> width="215" height="108">
        >
        > any tips???[/color]

        Two troubleshooting techniques that will help you in the future:

        * PHP is not everything: do check the generated HTML!

        IE: View-> Source
        Mozilla: View-> Page Source (or Ctrl+U)

        * Use the W3C Validator to test the validity of your HTML and CSS:

        W3C's easy-to-use markup validation service, based on SGML and XML parsers.


        This way you would have found that

        <img src="../Fotos/foo.jpg width="215"

        is invalid HTML, thus noticing the missing quote :)

        --
        -- Álvaro G. Vicario - Burgos, Spain
        -- http://bits.demogracia.com - Mi sitio sobre programación web
        -- Don't e-mail me your questions, post them to the group
        --

        Comment

        • Alvaro G Vicario

          #5
          Re: Insert JPG created with information from a DB in HTML

          *** bettina@coaster .ch wrote/escribió (26 Jun 2005 12:58:53 -0700):[color=blue]
          > <img src="../Fotos/<? $posavaso?> width="215" height="108">
          >
          > any tips???[/color]

          Two troubleshooting techniques that will help you in the future:

          * PHP is not everything: do check the generated HTML!

          IE: View-> Source
          Mozilla: View-> Page Source (or Ctrl+U)

          * Use the W3C Validator to test the validity of your HTML and CSS:

          W3C's easy-to-use markup validation service, based on SGML and XML parsers.


          This way you would have found that

          <img src="../Fotos/ width="215"

          is invalid HTML, thus noticing the missing equal and quote :)

          --
          -- Álvaro G. Vicario - Burgos, Spain
          -- http://bits.demogracia.com - Mi sitio sobre programación web
          -- Don't e-mail me your questions, post them to the group
          --

          Comment

          • bettina@coaster.ch

            #6
            Re: Insert JPG created with information from a DB in HTML

            Gracias Alvaro por tu ayuda, voy a tener en cuenta el troubleshooting .
            Pero aún cuando escribo las comillas antes de width no funciona:
            <img src="images/<?php $a ?>" width="48" height="30">

            Bettina

            Comment

            • Alvaro G Vicario

              #7
              Re: Insert JPG created with information from a DB in HTML

              *** bettina@coaster .ch wrote/escribió (27 Jun 2005 03:27:25 -0700):[color=blue]
              > Gracias Alvaro por tu ayuda, voy a tener en cuenta el troubleshooting .
              > Pero aún cuando escribo las comillas antes de width no funciona:
              > <img src="images/<?php $a ?>" width="48" height="30">[/color]

              Te falta un echo.

              --
              -- Álvaro G. Vicario - Burgos, Spain
              -- http://bits.demogracia.com - Mi sitio sobre programación web
              -- Don't e-mail me your questions, post them to the group
              --

              Comment

              • Emil

                #8
                Re: Insert JPG created with information from a DB in HTML

                <img src="images/<?php echo $a; ?>" width="48" height="30">

                //OENS

                "Alvaro G Vicario" <alvaro_QUITAR_ REMOVE@telecomp uteronline.com> skrev i en
                meddelelse news:2348p6z7fi wv$.1ob15zeyndk 17.dlg@40tude.n et...[color=blue]
                > *** bettina@coaster .ch wrote/escribió (27 Jun 2005 03:27:25 -0700):[color=green]
                >> Gracias Alvaro por tu ayuda, voy a tener en cuenta el troubleshooting .
                >> Pero aún cuando escribo las comillas antes de width no funciona:
                >> <img src="images/<?php $a ?>" width="48" height="30">[/color]
                >
                > Te falta un echo.
                >
                > --
                > -- Álvaro G. Vicario - Burgos, Spain
                > -- http://bits.demogracia.com - Mi sitio sobre programación web
                > -- Don't e-mail me your questions, post them to the group
                > --[/color]


                Comment

                Working...