Forum Moderators: coopster

Message Too Old, No Replies

concatenation problems

         

hal12b

8:55 pm on Jun 3, 2008 (gmt 0)

10+ Year Member



Why would this work
echo "<td><p><img src=\"http://www.abcwebsite.com/phptest/admin/images/$test.jpg\" /></p></td>";

but not this

echo "<td><p><img src=\"http://www.abcwebsite.com/phptest/admin/images/$row['picture'].jpg\" /></p></td>";

help!
Thanks

eelixduppy

9:04 pm on Jun 3, 2008 (gmt 0)



Because you are using an array in the second one without the correct syntax. You must surround it with braces like the following:

echo "<td><p><img src=\"http://www.example.com/phptest/admin/images/{$row['picture']}.jpg\" /></p></td>";

hal12b

12:05 pm on Jun 4, 2008 (gmt 0)

10+ Year Member



Thank you very much. I am new top PHP so will probably have some rather stupid questions.