View Full Version : syntax issues

07-03-2010, 09:18 AM
I'm having a slight problem setting an img tag in a variable. This variable will be called later in the page.

$avatar = $uploadrow['avatar'];
$avatarshow = "<img src=\'/avatars/$avatar\' width=\'100\' height=\'100\'>";

Now I am certain the problem is with my syntax in the avatarshow variable. I tested it by typing out the full name of the file, and it is shown just fine. But doing it this way causes problems. Any suggestions on fixing this code?

(I'm not getting any mysql errors)

07-03-2010, 09:24 AM
Single quotes only need escaping when contained in single quotes. Remove all the \ in the string. If the problem persists it lies in the use of data, so check the generated source to confirm the expected string.