Jump to content

unexpected t_string


Xtremer360

Recommended Posts

Are you using a syntax highlighter? You can see your problem above. My general rule of thumb is to use single quotes whenever possible.

 

echo '<img src="' . base_url() . 'assets/images/avatar.jpg" alt="" />';

 

I removed the $data->avatar_file, not really sure what you want done with that?

Basically, you were escaping your quotes but that buggered up your concatenation. You needed an extra quote, here is an example of how you'd do it how you were trying to:

 

echo "<img src=\"" .base_url() . "assets/images/avatar.jpg\" alt=\"\" />";

 

I still prefer the single quotes method though, that way you don't need to escape your double quotes.

Link to comment
https://forums.phpfreaks.com/topic/245438-unexpected-t_string/#findComment-1260579
Share on other sites

Well I didn't notice I had the avatar.jpg part in there but its going to have the users avatar in there so I tried this and I'm still getting the syntax error:

 

<?php
echo "<img src=\"" .base_url() . "assets/images/".$data->avatar_file."\" alt=\"\" />";
?>

Link to comment
https://forums.phpfreaks.com/topic/245438-unexpected-t_string/#findComment-1260588
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.