Jump to content
MakeWebGames

Recommended Posts

Posted

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. :(

Posted

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
Posted

$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()

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.   Paste as plain text instead

  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...