I have a table which displays a list of everyone who is currently online on my site, along with a few details about themselves.
I basically need to make it so their charactername in the table is clickable to view their profiles.
Heres the current code im using:
function whosonline()
{
$page = "Viewing someones profile will be coming soon.<p>";
$page .= "";
$onlinequery = doquery("SELECT * FROM {{table}} WHERE UNIX_TIMESTAMP(onlinetime) >= '".(time()-180)."' ORDER BY charname", "users");
$page .= "<table><th colspan='2' style='background-color:#dddddd;'>";
$page .= "<center>Who is Online</center></th>";
$page .= " <th colspan='4' style='background-color:#dddddd;'>";
$page .= "There are " . mysql_num_rows($onlinequery) . " user(s) online within the last 3 minutes: </th></tr><tr>";
$page .= " <th width=\"5%\" style=\"background-color:#dddddd;\">ID Number</th>";
$page .= "<th width=\"25%\" style=\"background-color:#dddddd;\">Character Name</th>";
$page .= "<th width=\"25%\" style=\"background-color:#dddddd;\">Class</th> \n";
$page .= "<th width=\"1%\" style=\"background-color:#dddddd;\">Level</th> \n";
$page .= "<th width=\"10%\" style=\"background-color:#dddddd;\">Last Seen</th>";
$page .= "<th width=\"30%\" style=\"background-color:#dddddd;\">Last Click \n";
$count = 1; while ($onlinerow = mysql_fetch_array($onlinequery)) {
if ($count == 1) { $color = "bgcolor='#ffffff' "; $count = 2; } else { $color = "bgcolor='#eeeeee' "; $count = 1; }
$page .= " <tr><td <td bgcolor=#FFFFFF width='5%'>";
$page .= $onlinerow["id"]." </td>";
$page .= " <td bgcolor=#FFFFFF width='25%'>".$onlinerow["charname"]." </td>";
$page .= " <td bgcolor=#FFFFFF width='25%'>".$onlinerow["charclass"]." </tr>";
$page .= " <td bgcolor=#FFFFFF width='1%'>".$onlinerow["level"]." </tr>";
$page .= " <td bgcolor=#FFFFFF width='10%'>".$onlinerow["currentaction"]." </td>";
$page .= " <td bgcolor=#FFFFFF width='30%'>".$onlinerow["onlinetime"]." </td></tr>";
}
$page .= "</table> ";
$page .= "<p>You may <a href=\"index.php\">return</a> to what you were doing, or use the compass on the right to start exploring.</center>";
display($page, "Who is Online");
}
I cant really explain in anymore detail other than showing this line of code which were taken from the previous 'whos online' section:
while ($onlinerow = mysql_fetch_array($onlinequery)) { $townrow["whosonline"] .= "<a href=\"index.php?do=onlinechar:".$onlinerow["id"]."\">".$onlinerow["charname"]."</a>" . ", "; }
This enabled people to click the character names to view profiles. Each profile link is the same, with their unique ID
eg: index.php?do=onlinechar:X (X being their user id)
Can anybody help me please to try and intergrate this into the code at the beginning of this topic.
thanks in advance for any help!