multidimensional array problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi all,
im very new to php but i think i jumped on the
toughest thing to learn. Im trying to create a
team roster that will show game, game type
and league and then show each member based
on the game type. Ive worked out alot of code
but just cant figure where im going wrong. so
here is my code. Any pointers would be greatly
appreciated.

this is an example of what im trying to do
http://www.chalkthree.com/exampleroster.html

php code
<?php
//begin member league table
$memroster = "SELECT inf_league.game, inf_league.type, inf_member.user_name, inf_member.rank, " .
            "inf_member.country, inf_member.email " .
            "FROM inf_league " .
"INNER JOIN inf_memberleague ON inf_league.gid = inf_memberleague.l_id " . "INNER JOIN inf_member ON inf_member.user_id = inf_memberleague.m_id";
$memrosterresults = mysql_query($memroster)
 or die(mysql_error());
 while ($row = mysql_fetch_array($memrosterresults)) {

foreach ($row as $game => $type) {
echo "<p>";
echo "$type";
 foreach ($row as $type => $user_name) {
echo "$user_name" . " - " . "$rank" . " - " . "$country" . " - " . "$email"; }
print '</p>';
}
}
//end member league table
?>








mysql


CREATE TABLE `inf_league` ( `gid` int(11) NOT NULL auto_increment, `game` varchar(255) NOT NULL, `type` varchar(255) NOT NULL, `league` varchar(255) NOT NULL, `season` varchar(255) NOT NULL, PRIMARY KEY (`gid`)) TYPE=MyISAM AUTO_INCREMENT=4 ;-- -- Dumping data for table `inf_league`-- INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (1, 'DF:BHD', 'TKOTH', 'TWL', '2006 1st Quarter');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (2, 'CoD2', 'CTF', 'TWL', '2006 2nd QTR');INSERT INTO `inf_league` (`gid`, `game`, `type`, `league`, `season`) VALUES (3, 'CoD2', 'Search & Destroy', 'CAL', '2006 4th QTR');-- ---------------------------------------------------------- -- Table structure for table `inf_member`-- CREATE TABLE `inf_member` ( `user_id` int(11) NOT NULL auto_increment, `user_level` int(2) NOT NULL default '0', `list_order` int(3) NOT NULL default '0', `user_name` varchar(100) NOT NULL default '', `password` varchar(25) NOT NULL default '', `email` varchar(100) NOT NULL default '', `country` text NOT NULL, `game` text, `rank` varchar(40) default NULL, `qoute` longtext, `config` int(1) default '0', `map` varchar(100) default '', `gun` varchar(100) default '', `brand` varchar(100) default '', `cpu` varchar(20) default '', `ram` varchar(20) default '', `video` varchar(100) default '', `sound` varchar(100) default '', `monitor` varchar(100) default '', `mouse` varchar(100) default '', PRIMARY KEY (`user_id`)) TYPE=MyISAM AUTO_INCREMENT=3 ;-- -- Dumping data for table `inf_member`-- INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (1, 1, 0, 'nitrox', 'test', 'itsme@xxxxxx', 'United States', 'CoD2', 'Founder', NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);INSERT INTO `inf_member` (`user_id`, `user_level`, `list_order`, `user_name`, `password`, `email`, `country`, `game`, `rank`, `qoute`, `config`, `map`, `gun`, `brand`, `cpu`, `ram`, `video`, `sound`, `monitor`, `mouse`) VALUES (2, 1, 1, 'raze', 'itsme', 'itsyou@xxxxxxxxxx', 'United States', NULL, 'Leader', NULL, 0, '', '', '', '', '', '', '', '', '');-- ---------------------------------------------------------- -- Table structure for table `inf_memberleague`-- CREATE TABLE `inf_memberleague` ( `l_id` int(4) NOT NULL, `m_id` int(4) NOT NULL) TYPE=MyISAM;-- -- Dumping data for table `inf_memberleague`-- INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 2);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (1, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 1);INSERT INTO `inf_memberleague` (`l_id`, `m_id`) VALUES (2, 2);

_________________________________________________________________
Get live scores and news about your team: Add the Live.com Football Page www.live.com/?addtemplate=football&icid=T001MSN30A0701

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux