Forum Moderators: coopster
I am trying to to link to and id table. Basically it is printing on the page the whole member list, but i want it to print the name, then you click on it and will show the profile.
Please help,
Thanks.
Btw here is the code for it:
<?php
$fields = array('name','aka', 'age', 'location', 'gun', 'phrase', 'system', 'resolution', 'connection', 'rank','fav_level','fav_weap','occupation','icq', 'email');
$fieldLabels = array('Game name', 'Real name', 'Age', 'Location', 'Weapon of choice', 'Quote', 'System specs', 'Game resolution', 'Connection type', 'Rank', 'Favourite Level(s)', 'Interests', 'Occupation', 'ICQ', 'Email');
$members = mysql_query("SELECT * FROM {$GLOBALS['prefix']}_members ORDER BY id");
$active = mysql_query("SELECT last_logged_in,id FROM {$GLOBALS['prefix']}_users ORDER BY id");
$counter = mysql_num_rows($members);
print <<<EOT
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=320");
}
// End -->
</SCRIPT>
<script>
<!--
function safemail(name, domain, display) {
displayed=(display==undefined)? name : display
document.write('<a href=mailto:' + domain + '>' + displayed + '</a>');
}
// -->
</script>
We currently have $counter $tag members. <BR><BR>
EOT;
while($row = mysql_fetch_array($members)) {
$row2 = mysql_fetch_array($active);
$date = createLongDate($row2[0]);
$time = createTime($row2[0]);
if($row["pic"]) {
$pic = explode("/", $row["pic"]);
$pic = "./images/members/".$pic[count($pic)-1];
}
else
$pic = "./images/members/noimage.gif";
for($j=0;$j<count($fields);$j++) {
$temp = $row["$fields[$j]"];
$results = array_merge($results, array("$fields[$j]"=>"$temp"));
}
$temp = $results["$fields[0]"];
$temp2 = $results["$fields[1]"];
$temp3 = count($fields)-1;
$temp4 = $results["$fields[14]"];
print <<<EOT
<table border="0" width="100%">
<tr>
<td align="left" colspan="3"><a name="$temp" href="mailto:$temp4"><b>$temp</b></a></td>
</tr>
<tr>
<td align="left" nowrap>$fieldLabels[1]: </td>
<td align="left" width="100%">$temp2</td>
<td rowspan="$temp3" align="right"><img src="$pic"></td>
</tr>
EOT;
for ($j=2;$j<count($fields)-2;$j++) {
$temp = $results["$fields[$j]"];
print <<<EOT
<tr>
<td align="left" nowrap>$fieldLabels[$j]: </td>
<td align="left" width="100%">$temp</td>
</tr>
EOT;
}
$temp = $results["$fields[13]"];
$temp2 = $results["$fields[14]"];
print <<<EOT
<tr>
<td align="left" nowrap>$fieldLabels[14]: </td>
<td align="left" width="100%"><script>safemail("$temp2","$temp2")</script></td>
</tr>
<tr>
<td align="left" valign="top" nowrap>$fieldLabels[13]: </td>
<td width="100%" align="left" valign="top">$temp
<img src="http://online.mirabilis.com/scripts/online.dll?icq=$temp&img=5" alt="Online Status" border="0" align="top">
</td>
</tr>
<tr>
<td align="left" valign="top" nowrap>Last Active:</td>
<td width=\"100%\" align=\"left\" valign=\"top\">$time, $date.</td>
</tr>
<tr><td></td></tr>
<tr><td colspan="3" align="center" valign="middle">¦ <a href="javascript:Start('./modules/public/icq/icq.php?icq=$temp')">ICQ Message</a> ¦
<a href="http://web.icq.com/whitepages/message_me?uin=$temp&action=message">Message Via ICQ</a> ¦
<a href="http://web.icq.com/whitepages/add_me?uin=$temp&action=add">Add to ICQ List</a> ¦ </td></tr>
<tr><td></td></tr>EOT;
print "</table>";
}
?>
$members = mysql_query("SELECT * FROM {$GLOBALS['prefix']}_members ORDER BY id");
$active = mysql_query("SELECT last_logged_in,id FROM {$GLOBALS['prefix']}_users ORDER BY id");....
while($row = mysql_fetch_array($members)) {
$row2 = mysql_fetch_array($active);
First things first. This is likely to lead to mysql errors because there is no reason to believe that you will have as many members as users. You probably want something like this (add in your global prefix and additional fields as necessary)
$query = "SELECT members.lastname, members.firstname, members.id, members.pic, users.last_logged_in FROM members, users WHERE members.id=users.id ORDER BY members.id");
$members = mysql_query($query);
while ($row = mysql_fetch_assoc($query))
{
$date = createLongDate($row['last_logged_in'])
if ($row['pic']) {etc}
}