Page 1 of 1

please what is wrong with this

Posted: Tue Feb 03, 2004 3:39 pm
by nutstretch
I have now got my string in which i am hoping to call an image.

I have put this code i but am getting an error

I have put the string into a variable but can't work out how to syntax it.
the code below shoes the concatenation


print "<td><img src=\""gifs/".$row['StyleID'].".jpg"\" ></td>";

Pleas what have i done wrong.

the string is called $test

Posted: Wed Feb 04, 2004 2:52 am
by timvw
print "<td><img src=\""gifs/".$row['StyleID'].".jpg"\" ></td>";


http://www.php.net/manual -> variables -> strings

print "<td><img src='gifs/{$row['StyleID'[}.jpg'></td>";

Posted: Wed Feb 04, 2004 8:06 am
by McGruff
Single quotes save having to escape double quotes in html. I always concatenate - syntax highlighting makes it much easier to see vars in strings.

Code: Select all

<?php
print '<td><img src="gifs' . $row['StyleID'] . '.jpg"></td>';
?>

Posted: Wed Feb 04, 2004 8:20 am
by kettle_drum

Code: Select all

print "<td><img src="gifs".$row['StyleID'].".jpg"></td>";
If your using "" then you must escape any " you wish to display with \".

You could of course use '' in which case you would need to do:

Code: Select all

print '<td><img src="gifs'.$row['StyleID'].'.jpg"></td>';