Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.