Rustywolf Posted March 30, 2010 Share Posted March 30, 2010 I have the following code: echo '<img src=' . $row[map] . '>'; echo '<img class="' . $row[username] . '" src="' . $row[figure] . '" >'; echo '<style type="text/css">'; echo '.' . $row[username]; echo '{'; echo "top: " . $row[ypos] * 35 + $row[ypos] * 2 + 2 . ';'; echo "left: " . $row[xpos] * 30 + $row[xpos] * 2 + 2 . ';'; echo '}'; echo '</style>'; (I know its not the best code but i will be cleaning it up after) Buy for some reason, i get this as my page source: <img src=./images/maps/testmap.png><img class="Rusty" src="./images/mage_white.png" ><style type="text/css">.Rusty{2;2;}</style> Why wont "Top: " and "Left: " echo? Link to comment https://forums.phpfreaks.com/topic/196949-php-echo-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2010 Share Posted March 30, 2010 It's got something to do with the evaluation of the expression being concatenated within the string. The following corrects the problem - echo '<img src='. $row[map] . '>'; echo '<img class="' . $row[username] . '" src="' . $row[figure] . '" >'; echo '<style type="text/css">'; echo '.' . $row[username]; echo '{'; echo "top: " . ($row[ypos] * 35 + $row[ypos] * 2 + 2) . ';'; echo "left: " . ($row[xpos] * 30 + $row[xpos] * 2 + 2) . ';'; echo '}'; echo '</style>'; Link to comment https://forums.phpfreaks.com/topic/196949-php-echo-problem/#findComment-1033959 Share on other sites More sharing options...
Rustywolf Posted March 30, 2010 Author Share Posted March 30, 2010 Thanks I was wondering why if i put it on a newline it worked... Link to comment https://forums.phpfreaks.com/topic/196949-php-echo-problem/#findComment-1034001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.