hi guys been searching for the past couple day trying to figure out whats wrong, if i stick this line of code anywhere outside of the html im running it works fine the variable is set to what it was expected to
var userID = <?php echo ($stats['displayname']); ?>
but if i stick it inside my code like below i get an error of Uncaught SyntaxError: Unexpected token var
script>
var userID = <?php echo ($stats['displayname']); ?>
var gamescore = new score.Submit(publicsitekey, teamName , userID{
})
</script>
when viewing the page pages html after running it looks like this
var userID = Marmalade var gamescore = new Score.Submit('8VDCBKu05bEAHebtB0pgqWdcEB60B5kA', 'RedTeam', userID{
})
i sure it a syntax issue where i forgot something in the var, or its not breaking and not reading a new line. but i cant figure it out for the life of me, any help is appreciated, or just the most simple easiest way to set an html var from a php var, without the user having to do anything, i have also tried adding a ; after ?> but it just add ; to the user display name