1
foreach ($values as $value)
    {

        echo("<td> "."<img src= \"$value[\"img\"]\" />"."</td>"); 
        print("</tr>");
    }

I am basically trying to print the image whose path I've stored in mysql database. However I am getting very confused with the img src in html and after trying a lot of ways, the image is still not being printed out.

2 Answers 2

4

you're escaping too many times. just be simple about it:

echo '<td><img src="'.$value['img'].'"/></td>'; 

You could also do it this way:

echo "<td><img src='{$value['img']}' /></td>";
Sign up to request clarification or add additional context in comments.

Comments

-1

I've corrected your code.

foreach ($values as $value)
    {

        echo("<td> "."<img src='".$value["img"]."' />"."</td>"); 
        print("</tr>");
    }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.