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
please what is wrong with this
Moderator: General Moderators
-
nutstretch
- Forum Contributor
- Posts: 104
- Joined: Sun Jan 11, 2004 11:46 am
- Location: Leicester
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>";
http://www.php.net/manual -> variables -> strings
print "<td><img src='gifs/{$row['StyleID'[}.jpg'></td>";
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>';
?>
Last edited by McGruff on Tue Aug 09, 2005 7:57 pm, edited 1 time in total.
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Code: Select all
print "<td><img src="gifs".$row['StyleID'].".jpg"></td>";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>';