MySQL Version: 5.1
$database="tarb89_ausus";
mysql_connect ("localhost", "tarb89_admin", "leccums");
@mysql_select_db($database) or die( "Unable to select database");
$result = mysql_query( "SELECT * FROM characters ORDER BY `player`")
or die("SELECT Error: ".mysql_error());
$num = mysql_num_rows($result);
if ($num > 0 ) {
$i=0;
while ($i < $num) {
$character_name = mysql_result($result,$i,"character_name");
$breed = mysql_result($result,$i,"breed");
$gender = mysql_result($result,$i,"gender");
$base_color = mysql_result($result,$i,"base_color");
$markings = mysql_result($result,$i,"markings");
$genetics = mysql_result($result,$i,"genetics");
$sire = mysql_result($result,$i,"sire");
$dam = mysql_result($result,$i,"dam");
$other = mysql_result($result,$i,"other");
$player = mysql_result($result,$i,"player");
$id = mysql_result($result,$i,"id");
echo "<b>$player</b><br>Horse ID Number: $id - $character_name - $breed - $gender - $base_color - $markings - $genetics - $sire - $dam - $other<br><br>";
++$i; } }
There are no errors in my statement as it displays what it's wrote to display correctly. What my question is, how do I display all of the queries in one table based on the entries of one column?
The best way for me to explain this is to demonstrate HOW I want the results to display on my website. I would like it to display like the following:
PLAYER ONE
- Character one, character information
- Character two, character information
PLAYER TWO
- Character one, character information
- Character two, character information
So on and so forth. I only want the Players to display once, but I want all of the characters and character information with the same player to display underneath the player name. I've tried a million different ways, and I'm just too new to PHP and MySQL I guess to figure this out. Any help would be extremely helpful.
Hopefully I got all of the information down from the rules.. Don't be too hard on the noob!