I was wondering how I could include data from another table in my script...
This code dosn't seem to print the print "{$row['squad_name']}"; found in the ($q) statement in the code using $squad. Its supposed to print the name of the squad when the userid is x...
can anyone help?
<?php
$db = mysql_connect("loc","---","---");
mysql_select_db (---);
$sql = "SELECT * FROM players WHERE playerid='{$_REQUEST['playerid']}'";
if (!$result = mysql_query($sql)) {
print "Invalid query ($sql) : " . mysql_error();
exit;
}
while ($row = mysql_fetch_assoc($result)) {
$squadid = $row[squadid];
$q = mysql_query("SELECT * FROM squads WHERE userid = '$squadid'");
$squad = mysql_query($q);
print "{$row['squad_name']}";
print "<table borderColor=#000000 cellSpacing=0 cellPadding=0 width=100% border=0>
<tr>
<td width=5%><font face=Verdana size=1 color=#FFFFFF><B>Squad: </B></td>
<td width=90%><font color=#938f7d size=1 face=Verdana>$squad</a></td>
</tr>
</table>";
}
?>