Reputation: 139
I'm trying to make an image clickable.
I'm getting an error saying 'syntax error, unexpected '<''
<img border="0" alt="img1" src="<img src='./assets/workImages/".$row['image1']."'>" width="100" height="100">
I've tried writing it a few ways but always seem to come with an error of some sort.
The fact that I have to use a file path and a PHP variable is whats making this look more confusing to me than it probably is.
Very very new to PHP so forgive any blatant stupidity, if any.
Upvotes: 0
Views: 35
Reputation: 681
It's unclear if you are doing this in html and then breaking in to your PHP to just echo out the $row value, or if you're echoing all of the html from inside PHP, which leads to two different solutions.
Solution 1 (this is HTML and you need to echo your php):
<img border="0" alt="img1" src="/assets/workImages/<?= $row['image1'];?>" width="100" height="100">
Solution 2 (We're echoing all of this from PHP):
echo '<img border="0" alt="img1" src="/assets/workImages/'.$row['image1'].'" width="100" height="100">';
Upvotes: 1