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 5 of 5
  1. #1
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,758
    Thanks
    83
    Thanked 110 Times in 109 Posts

    Get image from query

    I've tried everything I know with this. From ".$blah['value']." to {$blah['value']}
    The $usrow is successfully pulling the value from the database because I echo'd it and it works.
    I am guessing maybe to set it as a variable first?

    The page loads with this coding below but there is no image and in the source code it shows images/.png

    Oh and also some of the things like {} and ". ." break the page and it errors out.

    Thanks

    PHP Code:
    <div class="image"><img src="http://www.codingforums.com/images/<?php ".$usrow[class]." ?>.png" alt="" /></div>
    Last edited by myfayt; 05-04-2014 at 05:45 PM.
    Been a sign maker for 8 years. My business:
    American Made Signs

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,424
    Thanks
    30
    Thanked 878 Times in 876 Posts
    <div class="image"><img src="http://www.codingforums.com/images/<?php echo $usrow['class']; ?>." ?>.png" alt="" /></div>
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,758
    Thanks
    83
    Thanked 110 Times in 109 Posts
    I thought that would work, but nothing, still getting this: <img src="http://www.newrodgame.com/createchar/images/.png" alt="" />
    Been a sign maker for 8 years. My business:
    American Made Signs

  4. #4
    Senior Coder
    Join Date
    Apr 2010
    Posts
    1,758
    Thanks
    83
    Thanked 110 Times in 109 Posts
    Whew, finally got it to work. Here is what I had to do.

    PHP Code:
    $sel_image = $usrow['class'];

    <div class="image"><?php echo "<img src=\"http://www.newrodgame.com/createchar/images/$sel_image.png\">"?></div>
    Been a sign maker for 8 years. My business:
    American Made Signs

  5. #5
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,716
    Thanks
    65
    Thanked 564 Times in 551 Posts
    You need to var_dump($usrow['class']);

    I'm assuming the class column in your table contains the file name and not the actual file blob?
    I can't really think of anything to write here now...


 

Posting Permissions

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