Jump to content

Illegal string offset 'username' in


interlog

Recommended Posts

        $main->set('TRIVIA_GAME_LAST_PLAYED_BY', $last_played_by['username']);
        $main->set('TRIVIA_GAME_LAST_PLAYED_BY_PROFILE_LINK', get_profile_link($last_played_by['id']));
        $main->set("PLAY_LINK", $TS_SCRIPTS['PLAY'] . "?quiz_id=$row[id]");
        $main->set("HIGH_SCORE_LINK", $TS_SCRIPTS['GAME_INFO'] . "?fn=show_high_scores&quiz_id=$row[id]");

The error in the topic title triggers at this bit of code.

 

Any solutions to fixing it are welcome.

 

Thanks in advance.

 

 

Link to comment
Share on other sites

I don't know what the contents of your variables are but this is what will cause that message and show you what you should look for.

 

A string can be treated as an array of characters, so

$username = 'fred';

// you can reference the individual charcters
echo $username[0];  //--> f
echo $username[3];  //--> d

// but if the index used is non-numeric
echo $username[''];  //--> illegal string offset


Link to comment
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.