ok this is mainly me not knowing and understanding loops and me trying to do a loop inside of a loop i dont even know how to start
but i have a table field that returns data like this:
{pappy}{bob_smith}{bob_smith2}
i need to turn the above into this
<a href="(insert sql statement to grab a value via this name pappy)">pappy</a>
<a href="(insert sql statement to grab a value via this name bob_smith)">bob_smith</a>
<a href="(insert sql statement to grab a value via this name bob_smith2)">bob_smith</a>
here is the code i am working with and need to integrate what i need done into
<?php
$dblink = mysql_pconnect('', '', '') or die('Could not connect to the database: ' .mysql_error());
mysql_select_db('') or die('Could not select database');
$query="SELECT * FROM main_data ORDER BY `date` DESC";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
echo "<table border=2>\n";
echo "<tr><td><b>Date</b></td><td><b>Server</b></td><td><b>Whom to Kill</b></td><td><b>Who Wants them Dead</b></td><td><b>Why?</b></td><td><b>Killer(s)</b></td><td><b>How many people want this person dead?</b></td><td><b>Attack this user</b></td></tr>\n";
while ($i < $num) {
$date=mysql_result($result,$i,"date");
$server=mysql_result($result,$i,"server");
$whom=mysql_result($result,$i,"whom");
$why=mysql_result($result,$i,"why");
$whomrace=mysql_result($result,$i,"race");
if ($why == "1") {
$why="Killed me many days in a row";
}
if ($why == "2") {
$why="Above my level (+5)";
}
if ($why == "3") {
$why="Ninja Looted before a buy";
}
if ($why == "4") {
$why="Teach a lesson";
}
if ($why == "5") {
$why="No real reason/other";
}
if ($whomrace == "1") {
$whomracename="Vampire";
}
if ($whomrace == "2") {
$whomracename="Werewolf";
}
$killer=mysql_result($result,$i,"killer");
if ($killer == "") {
$killer="No one Yet";
}
$counter=mysql_result($result,$i,"counter");
$s1=mysql_result($result,$i,"submitter");
$result3 = mysql_query("SELECT * FROM account_data WHERE id=\"$s1\"");
$list = mysql_fetch_array($result3);
$s3 = $list['urn'];
$userver = $list['server'];
$bfid = $list['bfid'];
$race = $list['race'];
if ($race == "1") {
$race="Vampire";
}
if ($race == "2") {
$race="Werewolf";
}
// changed line
echo "<tr><td>$date</td><td>$server</td><td>$whom ($whomracename)</td><td><a href=\"http://s$userver.bitefight.org/bite/player.php?p=$bfid\" target=\"_blank\">$s3</a> ($race)</td><td>$why</td><td>$killer</td><td>$counter</td><td><a href=\"kill.php?whom=$whom\">Attack this user</a></td></tr>\n";
$i++;
}
// added line
echo "</table>\n";
mysql_close();
?>
the particular variable that i need to break apart is $killer
o and this is for a game so ignore the stuff about killing 😃
thx in advance