Jnerocorp Posted December 13, 2009 Share Posted December 13, 2009 I need my script to display each member in the clan that is specified. The clan id's are just numbers like 1 ... 2 ect... my problem is right now it only displays the last member in the mysql database in that clan here is my coding: <?php if(isset($_GET['id'])) { $clanid = $_GET['id']; mysql_connect("localhost", "jnero_admin", "sc55207") or die(mysql_error()); mysql_select_db("jnero_clanlist") or die(mysql_error()); $result = mysql_query("SELECT * FROM clans WHERE id='$clanid'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $clanname = $row['clanname']; $logo = $row['logo']; } $result = mysql_query("SELECT * FROM members WHERE clanid='$clanid'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $name = $row['name']; $ingamename = $row['ingamename']; $rank = $row['rank']; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head> <head> <title>Clan List - <?php echo $clanname; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <link href="index_files/general.css" rel="stylesheet" type="text/css"> </head> <div class="main" style="width: 960px; height: 800px"> <center> <h1> <?php echo $clanname; ?> </h1> <img src="<?php echo $logo; ?>"> <br><br> </center> <h3> Clan Members </h3> <?php for ($i = 0; $i < 1; $i++) { echo "Name: $name <br> Ingame Name: $ingamename <br> Rank: <b>$rank</b> <br> "; } ?> </div> <style type="text/css"> div.main_footer_block{ border:1px solid #CECECE; width: 960px; margin-left: auto; margin-right: auto; height:49px; background-image:url(templates/tmpl_uni/images/footer_part.png); font-family: Arial; font-size:11px; } div.powered_section { color:#333333; padding-left:10px; padding-top:5px; } div.powered_section a, div.powered_section a:link, div.powered_section a:visited { color: #3333CC; text-decoration: none; } div.powered_section a:hover, div.powered_section a:active { color: #3333CC; text-decoration: underline; } div.logo-section { padding-top:7px; padding-right:10px; text-align:right; } div.license_section { color:#000; padding-left:10px; padding-top:5px; } div.license_section a, div.license_section a:link, div.license_section a:visited { color: #3333CC; text-decoration: none; } div.license_section a:hover, div.license_section a:active { color: #3333CC; text-decoration: underline; } </style> <div class="main_footer_block" style="background: #FFF;"> <table width="100%"> <tbody><tr> <td valign="top"> <div class="powered_section"> Developed by: <a href="mailto:[email protected]">[email protected]</a> </div> <div class="license_section"> Copyright 2009 <a href="#">Clan List</a> © </div> </td> <td valign="top"> <div class="logo-section"> <a href="#"> Logo 156 x 28 here </a> </div> </td> </tr> </tbody></table> </div> </body> </html> <?php } else { echo "Invalid Clan Selected"; } ?> Link to comment https://forums.phpfreaks.com/topic/184963-help-with/ Share on other sites More sharing options...
GFXUniverse Posted December 13, 2009 Share Posted December 13, 2009 here you go <?php if(isset($_GET['id'])) { $clanid = $_GET['id']; mysql_connect("localhost", "jnero_admin", "sc55207") or die(mysql_error()); mysql_select_db("jnero_clanlist") or die(mysql_error()); $result = mysql_query("SELECT * FROM clans WHERE id='$clanid'") or die(mysql_error()); $row = mysql_fetch_array( $result ); $clanname = $row['clanname']; $logo = $row['logo']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml" lang="en-US"><head> <head> <title>Clan List - <?php echo $clanname; ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <link href="index_files/general.css" rel="stylesheet" type="text/css"> </head> <div class="main" style="width: 960px; height: 800px"> <center> <h1> <?php echo $clanname; ?> </h1> <img src="<?php echo $logo; ?>"> <br><br> </center> <h3> Clan Members </h3> <?php $result = mysql_query("SELECT * FROM members WHERE clanid='$clanid'") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $name = $row['name']; $ingamename = $row['ingamename']; $rank = $row['rank']; echo "Name: $name <br> Ingame Name: $ingamename <br> Rank: <b>$rank</b> <br> "; } ?> </div> <style type="text/css"> div.main_footer_block{ border:1px solid #CECECE; width: 960px; margin-left: auto; margin-right: auto; height:49px; background-image:url(templates/tmpl_uni/images/footer_part.png); font-family: Arial; font-size:11px; } div.powered_section { color:#333333; padding-left:10px; padding-top:5px; } div.powered_section a, div.powered_section a:link, div.powered_section a:visited { color: #3333CC; text-decoration: none; } div.powered_section a:hover, div.powered_section a:active { color: #3333CC; text-decoration: underline; } div.logo-section { padding-top:7px; padding-right:10px; text-align:right; } div.license_section { color:#000; padding-left:10px; padding-top:5px; } div.license_section a, div.license_section a:link, div.license_section a:visited { color: #3333CC; text-decoration: none; } div.license_section a:hover, div.license_section a:active { color: #3333CC; text-decoration: underline; } </style> <div class="main_footer_block" style="background: #FFF;"> <table width="100%"> <tbody><tr> <td valign="top"> <div class="powered_section"> Developed by: <a href="mailto:[email protected]">[email protected]</a> </div> <div class="license_section"> Copyright 2009 <a href="#">Clan List</a> © </div> </td> <td valign="top"> <div class="logo-section"> <a href="#"> Logo 156 x 28 here </a> </div> </td> </tr> </tbody></table> </div> </body> </html> <?php } else { echo "Invalid Clan Selected"; } ?> Link to comment https://forums.phpfreaks.com/topic/184963-help-with/#findComment-976407 Share on other sites More sharing options...
Jnerocorp Posted December 13, 2009 Author Share Posted December 13, 2009 thanks worked perfectly -John Link to comment https://forums.phpfreaks.com/topic/184963-help-with/#findComment-976412 Share on other sites More sharing options...
GFXUniverse Posted December 13, 2009 Share Posted December 13, 2009 You Welcome Link to comment https://forums.phpfreaks.com/topic/184963-help-with/#findComment-976424 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.