Jump to content


printf and display of image

  • Please log in to reply
1 reply to this topic

#1 stressedsue

  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 September 2006 - 12:43 AM


I want to display an image dynamically within the printf() function, where the image name resides on a database.  How do I embed the image name within the <img src> tag, which is within the printf() function?

Example of code that does not work:

    <p><img src='../art/'>%s</p>
    </tr>\n", $myrow["photoname"]");

Any help is greatly appreciated!!!

#2 Gaoshan

  • Members
  • PipPip
  • Member
  • 25 posts

Posted 30 September 2006 - 05:52 AM

It is the last " causing you trouble (the one right before the closing parenthesis). Lose it and you should be ok.
Just curious but why use print_r for this? I think a faster solution would be something like:
echo '<tr><td><p><img src="../art/' . $myrow[photoname] . '"></p></td></tr>';

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users