This is what I've done to display appropriate fields. Change things to suite your fields. This is just a bit of code for you to see how it's done.
$sql = "SELECT *
FROM $table_name
WHERE id = \"$id\"
";
$result = @mysql_query($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$name = $row['name'];
$email = $row['email'];
$city = $row['city'];
$state = $row['state'];
}
}
?>
<HEAD>
<TITLE>Member Details</TITLE>
</HEAD>
<BODY background="background1.jpg">
<center><font face=\"Verdana\" size=\"2\" color=#000000\"><strong>Member Details<br>
Details for <? echo "$username";?> from <? echo "$city"; ?></font></strong></center>
<font size="1">
<table cellspacing=0 cellpadding=30>
<tr><font size="3">
<th align=center valign=center width=100 height=30><strong>Profile</strong></br>
<th align=center valign=center width=100 height=30><strong>My Picture</strong></br>
</tr>
<tr>
<td valign=top><font size="3">
<? echo "<strong>Name:</strong><font color=#FF0000> $name</font color>"; ?><br>
<?
if ($city != "") {
echo "<strong>City:</strong><font color=#FF0000> $city</font color> <br>";
}
if ($state !=""){
echo "<strong>State:</strong><font color=#FF0000> $state</font> <br>";
}
Keep using the if($FIELD !=""){ . . . for all the fields you want displayed. If the field is blank it will not be displayed.
use this where you want a few lines to seperate displayed fields into specific groups
?>
</p>
<P>
<?
continue with the if($FIELD) . . .
The way I have it setup is in 2 columns if you want to use columns, put this where you want the 1'st column to end to begin the next column
End your last if with } then continue with this:
?>
<td valign=top>
<?
Start your next if($FIELD) . . .
to end use:
?>
</td>
</tr>
</table>
ANY OTHER HTML CODE YOU WANT TO DISPLAY
</BODY>
Hope this helps. I'm new to programming myself, I've found the following books to be useful: PHP Fast & Easy Web Development and Professional PHP Programming to be great help.