PDA

View Full Version : quick php question


DiscussAnything
11-03-2003, 03:39 PM
This is part of the index.php of vbhome lite:

$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
$pluralpm = iif ( $newpm['messages']!=1 , 's' , '' );
if ( !$newpm['messages'] )
{
$newpm['messages'] = 'No';
}
eval( '$pminfo = "' . gettemplate( 'home_pmloggedin' ) . '";' );
}


What I want to do is make the number of new PMs yellow, to make them stand out more. Currently if there are no PMs, it displays 'No', as the code indicates. The number of new PMs seems to just be the results of a query though, unformatted. What do I have to add to make it yellow only if the result is not 0 ?

Thanks

Xenon
11-03-2003, 03:49 PM
after thatif ( !$newpm['messages'] )
{
$newpm['messages'] = 'No';
}

add that:

else
{
$newpm['messages'] = '<font color="yellow">' . $newpm['messages'] . '</font>';
}

DiscussAnything
11-03-2003, 04:37 PM
Thanks :)

Xenon
11-03-2003, 07:50 PM
np :)