Topic: problem in header.php

I am working on the following substitution in header.php, but something is wrong:

// START SUBST - <playeroftheweek>
$myquery = $db->query('SELECT p.first_name, p.last_name, w.text FROM '.$db->prefix.'potw AS w INNER JOIN '.$db->prefix.'players AS p ON p.id=w.player_id WHERE w.recent=1') or error('Unable to fetch player of the week info', __FILE__, __LINE__, $db->error());
if ($db->result($myquery))
{
$playeroftheweek = $db->fetch_assoc($myquery);
$tpl_temp = '<div id="playeroftheweek">'."\n\t\t\t".'<h5>PLAYER OF THE WEEK</h5><h6>'.$playeroftheweek[first_name].' '.$playeroftheweek['last_name'].'</h6><p id="player">'.$playeroftheweek['text'].'</p>'."\n\t\t".'</div>';
}

$tpl_main = str_replace('<playeroftheweek>', $tpl_temp, $tpl_main);
// END SUBST - <playeroftheweek>

What am I doing wrong? First, the query doesn't return any results (which it should - at least one) and second, I have a pun_include behind the <playeroftheweek> tag in my template, but that doesn't show up.

Please help!

FluxBB - v1.4.8

Re: problem in header.php

Try this:

$player = $db->result($db->query('SELECT p.first_name, p.last_name, w.text FROM '.$db->prefix.'potw AS w INNER JOIN '.$db->prefix.'players AS p ON p.id=w.player_id WHERE w.recent=1'));

while($playeroftheweek = @mysqli_fetch_array($player))
{
    $tpl_temp = '<div id="playeroftheweek">'."\n\t\t\t".'<h5>PLAYER OF THE WEEK</h5><h6>'.$playeroftheweek['first_name'].' '.$playeroftheweek['last_name'].'</h6><p id="player">'.$playeroftheweek['text'].'</p>'."\n\t\t".'</div>';

}

Re: problem in header.php

Why do the changes have to be made Strofanto? Just asking, cuz...
Now I have a blank white screen... sigh

FluxBB - v1.4.8

Re: problem in header.php

If it doesn't work just ignore that, it wasn't actually a change, I though that would have worked.

Re: problem in header.php

Thanks, Strofanto.
Can anybody else help?

FluxBB - v1.4.8