Glen Posted October 24, 2008 Share Posted October 24, 2008 Hello again , I was wondering if it was possible to get results from my results i get from mysql output. For example my script returns the player id's of a certain clan i play in, in a game called tribalwars. Tribalwars offers you the chance to download data to make external sites, statistics ect. I have downloaded all the villages, players and clans world data in to a mysql database. And i am trying to find all the villages belong to a certain clan. There is not a file to download that gives you all the villages of a clan so i will have to make it. It will have to work like this, Each village, player and clan has its own id. So i will have to find all the players in a clan and find all the villages belonging to all those players in that clan, but i am not sure how i would go about that. <?php set_time_limit(300); //Connect to Mysql $dbhost = ''; $dbuser = ''; $dbpass = ''; mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); //Select Database $dbname = ''; mysql_select_db($dbname) or die('Error selecting database'); //Select table $query="SELECT * FROM players WHERE ally = '2463'"; $result=mysql_query($query); //Find the number of rows $num_rows = mysql_num_rows($result) or die(mysql_error()); //Loop $i=0; while ($i < $num_rows) { $id=mysql_result($result,$i,"id"); $name=mysql_result($result,$i,"name"); $ally=mysql_result($result,$i,"ally"); $villages=mysql_result($result,$i,"villages"); $points=mysql_result($result,$i,"points"); $rank=mysql_result($result,$i,"rank"); echo "<br>ID: $id<br>"; $i++; } mysql_close(); ?> This current code displays all the player id's of this clan how can i use those id's to find all of thier villages. Thanks for your time -Glen Quote Link to comment https://forums.phpfreaks.com/topic/130012-get-data-from-my-results/ Share on other sites More sharing options...
Barand Posted October 24, 2008 Share Posted October 24, 2008 Looks like you already get the villages Quote Link to comment https://forums.phpfreaks.com/topic/130012-get-data-from-my-results/#findComment-674086 Share on other sites More sharing options...
Glen Posted October 24, 2008 Author Share Posted October 24, 2008 Looks like you already get the villages No, that is the number of villages the player has. Sorry for not making that clear. Quote Link to comment https://forums.phpfreaks.com/topic/130012-get-data-from-my-results/#findComment-674087 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.