PDA

View Full Version : PHP - problem with underscore


neverstop
06-08-2009, 04:51 PM
Hi I am trying to modify some code to add an avatar. Here is the line of code:

$spitblogs .= "<div style=\"float:left;padding:5px\"><img width=\"50px\" src=\"customavatars/avatar$userid_$blog_avatar.gif\" class=\"inlineimg\" /></div><a style=\"font-size:12px\" href=\"{$vbulletin->options[bburl]}/blog.php?b=$blogid\"><strong>$blog_title</strong></a><br /><span class=\"shade\">$blog_dateline by $blog_username</span><br />";

The problem is with customavatars/avatar$userid_$blog_avatar.gif

When ever I try it the underscore after $userid is wreaking havoc with me. When I add the underscore $userid no loger works. Im sure this is an easy fix but I am not a programmer.

Thanks in advance,
Ian

EnIgMa1234
06-08-2009, 05:18 PM
Use:

$spitblogs .= "<div style=\"float:left;padding:5px\"><img width=\"50px\" src=\"customavatars/avatar".$userid."_".$blog."_avatar.gif\" class=\"inlineimg\" /></div><a style=\"font-size:12px\" href=\"".{$vbulletin->options[bburl]}."/blog.php?b=".$blogid."\"><strong>".$blog_title."</strong></a><br /><span class=\"shade\">".$blog_dateline." by ".$blog_username."</span><br />";

neverstop
06-08-2009, 05:43 PM
Parse error: syntax error, unexpected '{' in ...

I get that error on the line I replaced

--------------- Added 1244487924 at 1244487924 ---------------

Got it working, thanks enigma