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
https://forums.phpfreaks.com/topic/296762-illegal-string-offset-username-in/
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


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.