Here’s the code with the function that won’t work!
[php] $itemsRaw = explode(" “, $player[‘inventory’]);
foreach ($itemsRaw as $inv){
$contents = explode(”-", $inv);
if(strlen($contents[0]) > 0 && strlen($contents[1]) > 0 && $contents[1] > 0)
echo getItemName($contents[0]) . " (" . number_format($contents[1]) . “)
”;
}[/php]
Here’s my function:
[php]function getItemName($id_raw){
$id = $id_raw - 1;
$q = $db->query(“SELECT * FROM items WHERE id = $id”) or die(mysql_error());
$f = $db->fetch_assoc($q);
return $f[‘name’];
}[/php]
It stops the page when it gets to that point and won’t load anything else and the function doesn’t even work with it What’s wrong with it? If anything…