Cronic Posted April 19, 2012 Share Posted April 19, 2012 Catchable fatal error: Object of class User could not be converted to string in /home/u982643937/public_html/MafiaHeros Engine/city.php on line 140 line 135 t/m 147 $result = mysql_query("SELECT * FROM `dailygameevents` ORDER BY `timestamp` DESC LIMIT $offset, $rowsperpage"); if(mysql_num_rows($result) > 0) { while($line = mysql_fetch_array($result)) { $player = new User($line['player']); $text = str_replace("[-_USERID_-]", $player->formattedname, $line['text']); echo "<tr><td style='border-right: 1px solid #444444; border-bottom: 1px solid #444444;' width='82%'>".$player."</td><td style='border-right: 1px solid #444444; border-bottom: 1px solid #444444;' width='18%'>".date(d." ".F." ".Y.", ".g.":".ia,$line['timestamp'])."</td></tr>"; } echo "</table>"; } else { echo "</table>"; echo "<br /><center>No game events have occurred today.</center>"; } echo "<br />"; Anyone know what i'm doing wrong? I really don't see the problem. :( Quote Link to comment Share on other sites More sharing options...
Cronic Posted April 19, 2012 Author Share Posted April 19, 2012 Function to add it to the database. function DailyGameLog($id, $text, $extra="0") { $time = time(); $text = addslashes($text); $result = mysql_query("INSERT INTO `dailygameevents` (`player`, `text`, `timestamp`, `extra`) VALUES ('".$id."', '".$text."', '".$time."', '".$extra."')"); } Tried to make a log for when people level: Send_Event ($this->id, "You have just gained a level.", $this->id); DailyGameLog($user_class->id, "[-_USERID_-] has gained a level."); @ php my admin logid player text timestamp extra 1 1 [-_USERID_-] has gained a level. 1334868546 0 Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 19, 2012 Share Posted April 19, 2012 $player->formattedname Means its trying to find a public $formattedname = ''; var. But your formattedname is a function, so make it look for a function by adding () to the end like $player->formattedname() Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 19, 2012 Share Posted April 19, 2012 use $user_class->username ancd that does the trick Quote Link to comment Share on other sites More sharing options...
Cronic Posted April 19, 2012 Author Share Posted April 19, 2012 Thanks, works now ;) [ATTACH=CONFIG]341[/ATTACH] Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted April 19, 2012 Share Posted April 19, 2012 So which method fixed it? Quote Link to comment Share on other sites More sharing options...
Lithium Posted April 20, 2012 Share Posted April 20, 2012 HD: mine :P it's a defined var on GRPG :) Quote Link to comment Share on other sites More sharing options...
Cronic Posted April 21, 2012 Author Share Posted April 21, 2012 Thank you Lithium, That worked. Much appreciated. :cool: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.